{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lesson Set 9 - CS 1136 Lab 9 Methods Continued Exercise 1...

This preview shows pages 1–3. Sign up to view the full content.

CS 1136 Lab 9 Methods Continued Exercise 1: The following program takes two numbers (pay rate & hours) and multiplies them to get gross pay. It then calculates net pay by subtracting 15% of the gross pay. Copy this code into your compiler. Follow the code and the comments to understand how the program works and fill in the appropriate code so the program performs as it should. public class Lab9_Ex1 { public static void main(String [] args) { double payRate; double grossPay; double netPay; int hours; Scanner input = new Scanner(System.in); System.out.println("Welcome to the Pay Roll Program"); printDescription(); //Call to Description method System.out.print("Please input the pay per hour: "); payRate = input.nextDouble(); System.out.println("\nPlease inpu t the number of hours worked: “) ; hours = input.nextInt(); System.out.println(“ \ n”); grossPay = computePaycheck(payRate,hours); netPay = computeNetPay(grossPay); // Fill in the code to output grossPay and to calculate netPay System.out.println("The net pay is \$" + netPay); System.out.println("We hope you enjoyed this program"); System.exit(0); } // ******************************************************************** // printDescription // // task: This method prints a program description // data in: none // data out: none // // ******************************************************************** public static void printDescription() //The method heading { System.out.println("*********************************************\n");

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
System.out.println("This program takes two numbers (pay rate & “ + hours)"); System.out.println("and multiplies them to get gross pay "); System.out.println("it then calculates net pay by subtracting 15%"); System.out.println("********************************************\n"); } // ********************************************************************* // computePaycheck // // task: This method takes rate and time and multiples them to // get gross pay.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern