// 9/13/2017 /** The Payroll class calculates the Net Pay for two * employees. This is version 2 of the Payroll class. * This version READS IN the data from the keyboard. */ import java.util.Scanner; public class Payroll2 { /** * pay is calculated by multiplying hours times rate, and * then subtracting 11% for taxes. */ public static void main(String[] args) { final double TAXES = .11; // employees pay 11% income tax double taxes=0.0, rate=0.0; double hoursWorked=0; String name; // use Scanner class to help work with System.in // System.in is the object that READS in data from keyboard // I declare a Scanner object to make System.in easier to deal // with Scanner readObject = new Scanner(System.in); // prompt the user to enter a name System.out.print("Enter a name of employee: "); name = readObject.nextLine(); // prompt the user to enter data for hours and rate System.out.print("Enter number of hours worked and rate of pay: "); // now I call methods that are part of the Scanner class hoursWorked = readObject.nextDouble(); rate = readObject.nextDouble(); double pay = rate * hoursWorked; taxes = TAXES*pay; pay-=taxes; System.out.println("Net pay for " + name + " is: $" + pay); /*** // now process 2nd employee pay = rate * hoursWorked; taxes = TAXES*pay; pay-=taxes; System.out.println("Net pay for " + name + " is: $" + pay); ***/ } } /* Lab 4: DUE Monday Sept 18. * Read in coordinates of two points on a graph. * Calculate and print: * 1. This distance between the 2 points. * 2. The slope of the line that runs through the 2 points. * * Use pgming process: understand problem, pseudocode, code, etc. */