Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// Money import java.util.Scanner; public class Money { public static void main(

ID: 3653403 • Letter: #

Question

// Money import java.util.Scanner; public class Money { public static void main(String[] args){ int employeeNumber; double hourlyWage, hoursWorked, hoursWorkedOvertime, totalPay; Scanner keyboard = new Scanner(System.in); System.out.println("What is the employee number?"); employeeNumber = Integer.parseInt(keyboard.nextLine()); System.out.println("What is the hourly wage amount?"); hourlyWage = Double.parseDouble(keyboard.nextLine()); System.out.println("What is the number of regular hours worked?"); hoursWorked = Double.parseDouble(keyboard.nextLine()); System.out.println("What is the number of overtime hours worked?"); hoursWorkedOvertime = Double.parseDouble(keyboard.nextLine()); totalPay=(hoursWorked*hourlyWage+hoursWorkedOvertime*hourlyWage*1.5); System.out.printf("Total Pay : $%.2f", totalPay); } } 1. Use an object of type String to add a person's name to the data assigned within your program. 2. Use methods to carry out the work of your program. The main block of code should only consist of method calls to carry out the tasks. Remember that method names begin with a verb, reflecting the action being carried out by that block of code. Also keep in mind that methods are narrow in focus, completing only one basic function. Most of the methods in this project will be relatively short; however, be aware of the fact that having only one method in this revision will not constitute successful completion of this project.

Explanation / Answer

import java.util.Scanner; public class Money { int employeeNumber; String employeeName; double hourlyWage, hoursWorked, hoursWorkedOvertime, totalPay; Scanner keyboard = new Scanner(System.in); void takingName() { System.out.println("What is the employee name?"); employeeName = keyboard.nextLine(); } void takingNumber() { System.out.println("What is the employee number?"); employeeNumber = Integer.parseInt(keyboard.nextLine()); } void takingWage() { System.out.println("What is the hourly wage amount?"); hourlyWage = Double.parseDouble(keyboard.nextLine()); } void takingRegularhours() { System.out.println("What is the number of regular hours worked?"); hoursWorked = Double.parseDouble(keyboard.nextLine()); } void takingOvertimehours() { System.out.println("What is the number of overtime hours worked?"); hoursWorkedOvertime = Double.parseDouble(keyboard.nextLine()); } void finalOutput() { totalPay=(hoursWorked*hourlyWage+hoursWorkedOvertime*hourlyWage*1.5); System.out.printf("Total Pay : $%.2f", totalPay); } public static void main(String[] args) { Money m = new Money(); m.takingName(); // calls to the mehtods m.takingNumber(); m.takingWage(); m.takingRegularhours(); m.takingOvertimehours(); m.finalOutput(); } }