Explore BrainMass
Share

Explore BrainMass

    Modify a program to read data till the users says stop

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Modify the Payroll Program application so it continues to request employee information
    until the user enters stop as the employee name. In addition, program the application to
    check that the hourly rate and number of hours worked are positive numbers. If either the
    hourly rate or the number of hours worked is not a positive value, the application should
    prompt the user to enter a positive amount.

    I would like to stick to as basic of program as possible. I am not sure if I used the while and if statements correct.

    © BrainMass Inc. brainmass.com October 9, 2019, 8:58 pm ad1c9bdddf
    https://brainmass.com/computer-science/program-execution/modify-a-program-to-read-data-till-the-users-says-stop-168487

    Attachments

    Solution Preview

    There are two issues here. First, the compilation problem is due to a simple typo. If you look around line 34 in the program you will see "System.outprint". Notice that the "." between "out" and "print" is missing if you add that "." ...

    Solution Summary

    In this solution I show how to use a while loop to continue to query the user for input until the user enters "stop". This is an addition to a Java payroll program that asks the user to enter employee names, pay rates, and hours. The program calculates the weekly pay for the given employee.

    $2.19