web123456

JAVA summarizes those simple syntaxes to make an annual salary calculation program

  • import ;
  • public class SalaryCalculator{
  • public static void main(String[] args){
  • Scanner s = new Scanner();
  • ("***My annual salary calculator****");
  • ("1. Enter 88. Exit the program\n2. Enter 66. Continue to calculate");
  • while(true){
  • ("Please enter monthly salary");
  • int monthSalary = ();
  • ("Please enter a salary of several months a year");
  • int months = ();
  • int yearSalary = monthSalary*months; //Annual salary
  • ("The annual salary is:"+yearSalary);
  • if(yearSalary>200000){
  • ("Congratulations to more than 98% of Chinese people");
  • }else if(yearSalary>=100000){
  • ("Congratulations to more than 90% of Chinese people");
  • }
  • ("Enter 88.Exit the program");
  • int comm = ();
  • if(comm==88){
  • ("Exit program");
  • break;
  • }else if(comm==66){
  • ("Continue to calculate the next salary");
  • continue;
  • }
  • }
  • }
  • }