{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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");
Image of page 1

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

View Full Document Right Arrow Icon
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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern