//******************************************************************** // labquiz3.java Author: Brenneman // // Driver to test the use of an Employee class. // YOU SHOULD NOT NEED TO MAKE ANY CHANGES TO THIS FILE! //******************************************************************** import cs1.Keyboard; import java.text.NumberFormat; public class labquiz3 { //----------------------------------------------------------------- // Asks the user to enter a name and payrate to set up an // employee object. Then asks for a number of hours worked // and calculates the pay for that employee. //----------------------------------------------------------------- public static void main (String[] args) { System.out.println ("Please enter an employee name:"); String name = Keyboard.readString(); System.out.println ("Enter the hourly rate for " + name + ":"); double rate = Keyboard.readDouble(); // -- sets up a new employee ----------------------------------- Employee worker = new Employee(name, rate); System.out.println ("How many hours did " + name + " work?"); double hours = Keyboard.readDouble(); // -- calculates the pay for an employee ----------------------- double pay = worker.calcPay(hours); // -- NumberFormat used for formatting the pay as currency ----- NumberFormat money = NumberFormat.getCurrencyInstance(); System.out.println("----------------------------------"); System.out.println(worker); System.out.println("Paycheck is " + money.format(pay)); System.out.println("----------------------------------"); } // end main } // end class