Java 代码未打印。请输入您的年销售额,但生成成功
我有我的代码,它应该打印一行,“请输入你的年销售额。”输入后,它应该进行计算。我肯定我遗漏了什么,但我不确定是什么…请帮助Java 代码未打印。请输入您的年销售额,但生成成功,java,printing,build,println,Java,Printing,Build,Println,我有我的代码,它应该打印一行,“请输入你的年销售额。”输入后,它应该进行计算。我肯定我遗漏了什么,但我不确定是什么…请帮助 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package annualcompensation;
import java.util.Scanner;
/*
* This program will calculates the total annual compensation
* of a salesperson. It will ask the user to enter annual sales,
* and it will display the total annual compensation for the
* salesperson.
*/
public class AnnualCompensation {
public static void main(String args[]) {
}
double fixedSalary;//Declares a double variable named fixed salary.
double annualSales;//Declares a double variable named annual sales.
double commission; //Declares a double variable named comission.
public void AnnualCompensation()
{
// The salesperson earns the fixed yearly salary of $60,000
fixedSalary = 60000.00;
}
// The salesperson's yearly sales will be displayed
public double getyearlySales(){
return annualSales;
}
// Create a Scanner object to read input.
public void readData(){
Scanner input = new Scanner(System.in);
System.out.print("Please enter in your annual sales: ");
// The program will the print the salesperson's annual sales
annualSales = input.nextInt();
}
public void calculateCommission() {
// Indicates salesperson's commission is 5% of thier annual sales
commission = 0.5 * annualSales;
}
public double getCommission(){
return commission;
}
// The program will display salesperson's total annual compensation
public double getTotalAnnualCompensation (){
return fixedSalary + getCommission();
}
public class SimpleCalculation {
public void main(String[] args) {
// Creat a new object AnnualCompensation
AnnualCompensation acct = new AnnualCompensation();
// ask user to enter annual sales and get data
acct.readData();
// calculate commission of sales
acct.calculateCommission();
// Display the total annual compensation
System.out.println("The the total annual compensation is: $" + acct.getTotalAnnualCompensation());
}
}
}
它当前打印的是什么?它不打印任何内容,只显示“构建成功(总时间:0秒)”您是如何运行该程序的?我使用的是NetBeans IDE 8.0.2。@Tiaroakes-否。我的意思是您是如何执行该程序的?。您必须运行/执行它当前打印出什么?它不打印任何内容,只显示“构建成功(总时间:0秒)”您是如何运行该程序的?我使用的是NetBeans IDE 8.0.2。@Tiaroakes-不。我的意思是您是如何执行该程序的?。你必须运行/执行它