9 design a program that computes pay for employees

This preview shows page 36 - 40 out of 77 pages.

We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
Programming Logic and Design, Introductory
The document you are viewing contains questions related to this textbook.
Chapter 6 / Exercise 19
Programming Logic and Design, Introductory
Farrell
Expert Verified
9. Design a program that computes pay for employees. Allow a user to continuously input employees’ names until an appropriate sentinel value is entered. Also input each employee’s hourly wage and hours worked. Compute each employee’s gross pay (hours times rate), withholding tax percentage (based on Table 6-5), withholding tax amount, and net pay (gross pay minus withholding tax). Display all the results for each employee. After the last employee has been entered, display the sum of all the hours worked, the total gross payroll, the total withholding for all employees, and the total net payroll. Weekly Gross Pay ($) Withholding Percent (%) 0.00 – 300.00 10 300.01 – 550.00 13 550.01 – 800.00 16 800.01 – up .000 20 Table 6-5 Withholding percentage based on gross pay 36
We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
Programming Logic and Design, Introductory
The document you are viewing contains questions related to this textbook.
Chapter 6 / Exercise 19
Programming Logic and Design, Introductory
Farrell
Expert Verified
Programming Logic and Design, 8e Solutions 6- Pseudocode: start Declarations 37
Programming Logic and Design, 8e Solutions 6- string empName num salary num hrsWorked num x num grossPay num withTax num netPay num totalGrossPay = 0 num totalHrsWorked = 0 num totalWithTax = 0 num totalNetPay = 0 string QUIT = “zzzz” num SIZE = 4 num WITH_RATES[SIZE] = 0.10, 0.13, 0.16, 0.20 num WITH_RANGES[SIZE] = 0, 300.01, 550.01, 800.01 getReady() while empName <> QUIT detailLoop() endwhile finishUp() stop getReady() output “Enter an employee name or ”, QUIT, “ to quit” input empName return detailLoop() output “Enter ”, empName, “’s hourly wage and hours worked” input salary, hoursWorked grossPay = hrsWorked * salary totalHrsWorked = totalHrsWorked + hrsWorked totalGrossPay = totalGrossPay + grossPay x = SIZE – 1 while grossPay < WITH_RANGES[x] x = x – 1 endwhile withTax = grossPay * WITH_RATES[x] totalWithTax = totalWithTax + withTax netPay = grossPay – withTax totalNetPay = totalNetPay + netPay output empName, grossPay, WITH_RATES[x] * 100, withTax, netPay output “Enter an employee name or ”, QUIT, “ to quit” input empName return finishUp() output totalHrsWorked, totalGrossPay, totalWithTax, totalNetPay return 38
Programming Logic and Design, 8e Solutions 6- 10. Countrywide Tours conducts sightseeing trips for groups from its home base in Iowa. Create an application that continuously accepts tour data, including a three- digit tour number, the numeric month, day, and year values representing the tour start date, the number of travelers taking the tour, and a numeric code that represents the destination. As each tour’s data is entered, verify that the month, day, year, and destination code are valid; if any of these is not valid, continue to prompt the user until it is. The valid destination codes are shown in Table 6-6. Code Destination Price per Person ($) 1 Chicago 300.00 2 Boston 480.00 3 Miami 1050.00 4 San Francisco 1300.00 Table 6-6 Countrywide Tours codes and prices Design the logic for an application that outputs each tour number, validated start date, destination code, destination name, number of travelers, gross total price for the tour, and price for the tour after discount. The gross total price is the tour price per guest times the number of travelers. The final price includes a discount for each person in larger tour groups, based on Table 6-7. Number of Tourists Discount per Tourist ($) 1-5 0 6-12 75 13-20 125 21-50

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture