error: class, interface, or enum expected java.util.Scanner

Publié le: 26 février 2018
sur la chaîne: Legendary Computer Programmer
34,676
103

like and subscribe!
try it out yourself with unfixed code:

java.util.Scanner; //initialize scanner

public class Main // defines class name
{

public static void main(String[] args) {

// create Scanner to obtain input from command window
Scanner input = new Scanner(System.in);


double hours; // number of hours worked input
double pay; // rate of hourly wage input
double overtime; // used to calculate overtime
double overtimePay;

// First input is for employee #1
System.out.print("Enter the number of regular hours the employee Worked "); // prompt for user input
hours = input.nextDouble();

System.out.print("Enter the number of overtime hours the employee worked "); //
overtime = input.nextDouble();

System.out.print("Enter the payrate of the employee "); // prompt for user input
pay = input.nextDouble();

System.out.print("Enter the overtime payrate of the employee "); // prompt for user input
overtimePay = input.nextDouble();

if (overtime == 0)

System.out.printf("Gross pay for the employee is %.2f\n", hours * pay);

// print to screen results
else {

System.out.printf("Gross pay for the employee is %.2f\n", (hours * pay) +
(overtime * (pay * overtimePay)));

System.out.printf("overtime pay for the employee is %.2f\n", (overtime * (pay * overtimePay)));

System.out.printf("regular pay for the employee is %.2f\n", (hours * pay));
}


}

}


Sur cette page du site, vous pouvez voir la vidéo en ligne error: class, interface, or enum expected java.util.Scanner durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Legendary Computer Programmer 26 février 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 34,676 fois et il a aimé 103 téléspectateurs. Bon visionnage!