我运行我的项目但收到此消息。
“终止Payroll [Java Application] /Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java”
我是eclipse和java的新手。我不知道下载或做什么。请帮忙。
java版“1.8.0_25” Java(TM)SE运行时环境(版本1.8.0_25-b17) Java HotSpot(TM)64位服务器VM(内置25.25-b02,混合模式)
import java.util.Scanner;
public class Employee {
Scanner keyboard = new Scanner(System.in);
private String firstName = keyboard.nextLine();
private String lastName = keyboard.nextLine();
private double hourlyPayRate = keyboard.nextDouble();
private double hoursWorked = keyboard.nextDouble();
private static final double FEDERAL_TAX_RATE = 18.0;
private static final double PROVINCIAL_TAX_RATE = 4.5;
private static final double EMPLOYMENT_INSURANCE = 22.35;
private static final double UNION_DUES = 7.85;
public void setFirstName(String firstName) {
System.out.println("Enter the employee's name (first then last): " + keyboard.next());
firstName = keyboard.next();
}// setFirstName
public void setLastName(String lastName) {
lastName = keyboard.next();
}// setLastName
public void setHourlyPayRate(double hourlyPayRate) {
System.out.println("Enter " + firstName + lastName + "'s hourly pay rate: " );
}// SetHourlyPayRate
private String getFirstName() {
return firstName;
}// firstName
private String getLastName() {
return lastName;
}// lastName
private double getHourlyPayRate() {
return hourlyPayRate;
}// hourlyPayRate
private double getHoursWorked() {
return hoursWorked;
}// hoursWorked
public double calculateGrossPay(){
return hourlyPayRate * hoursWorked;
}
public double calculateFederalTax() {
return calculateGrossPay() * FEDERAL_TAX_RATE;
}// FEDERAL_TAX_RATE()
public double calculateProvincialTax() {
return calculateGrossPay() * PROVINCIAL_TAX_RATE;
}// PROVINCIAL_TAX_RATE
public double getEmploymentInsurance() {
return calculateGrossPay() * EMPLOYMENT_INSURANCE;
}// EMPLOYMENT_INSURANCE
public double getUnionDues() {
return calculateGrossPay() * UNION_DUES;
}// UNION_DUES
public double calculateNetPay(){
return calculateGrossPay() - calculateGrossPay() +getUnionDues() + getEmploymentInsurance() + calculateProvincialTax() + calculateFederalTax();
}
public void setHoursWorked(double hoursWorked) {
}// setHoursWorked
}// Employee()
main()就是这个
/**
*
*/
package employee;
/**
* @author Nico
*
*/
import java.util.Scanner;
public class Payroll {
Employee employee = new Employee();
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Enter the employee's name (first then last):\n");
System.out.print("Enter Elly Funt's hourly pay rate: \n" );
System.out.print("Enter the number of hours Elly Funt worked this rate: \n" );
System.out.print("\n");
System.out.print("Employee Pay Summary: \n");
System.out.print("Employee Name: \n");
System.out.print("Hourly rate: \n");
System.out.print("Hours worked: \n");
System.out.print("\n");
System.out.print("Gross Pay: \n");
System.out.print("Dedcutions: \n");
System.out.print("\tFederal tax: \n");
System.out.print("\tProvincial tax: \n");
System.out.print("\tEmployment Insurance: \n");
System.out.print("\tUnion Dues: \n");
System.out.print("Net Pay: \n");
}//Main()
}//Payroll
答案 0 :(得分:2)
这意味着您的程序已终止,主要方法已完成。