/* 9/11/2019 Problem: given information about two Employees, calculate and print pay */ import java.util.Scanner; /** This is version 0 of Payroll. It reads in the data and calculates * gross pay for 2 employees. */ public class Payroll { /** read in: name, ID#, rate, hours * multiply rate*hours to get gross pay */ public static void main(String[] args) { // we calculate gross pay, later will add overtime, taxes double rate, hours, pay; String name; int idnum; Scanner sc = new Scanner(System.in); // gives us a Scanner object to help read // prompt the user System.out.println("Enter employee 1's ID number: "); idnum = sc.nextInt(); sc.nextLine(); // skip \n System.out.println("Enter employee 1's name: "); // read in user input name = sc.nextLine(); System.out.println("You entered: " + idnum + " " + name); System.out.println("Enter employee 1's hours and rate: "); // read in user input hours = sc.nextDouble(); rate = sc.nextDouble(); System.out.println("you entered hours: " + hours + " rate: " + rate); pay = rate * hours; System.out.println(idnum + " " + name + " " + pay); // NOW PROCESS EMPLOYEE 2 // prompt the user System.out.println("Enter employee 2's ID number: "); idnum = sc.nextInt(); sc.nextLine(); // skip \n System.out.println("Enter employee 2's name: "); // read in user input name = sc.nextLine(); System.out.println("You entered: " + idnum + " " + name); System.out.println("Enter employee 2's hours and rate: "); // read in user input hours = sc.nextDouble(); rate = sc.nextDouble(); System.out.println("you entered hours: " + hours + " rate: " + rate); pay = rate * hours; System.out.println(idnum + " " + name + " " + pay); sc.close(); } }