Algorithm: 1. Prompt the user for number of hours. 2. Read the value for hours. 3. Prompt the user for hourly rate. 4. Read the hourly rate. 5. Prompt the user for amount of bonus. 6. Read the value for bonus. 7. Compute the pay. 8. Compute the totalPay by adding bonus to pay. 9. Compute the tax deduction by multiplying 30% times totalPay. 10. Compute the netPay by subtracting tax from totalPay. 11. Neatly print and label the following: a. totalPay b. tax c. netPay Put your program on one of the PCs using a stand alone compiler such as Dev C++, or online compiler such as C++ shell. Name your program salary.cpp and save it on your cloud drive or flash drive after it works. You may write your complete program by hand first and document it as done in the sample class programs. Compile and run your program. It is recommended that you print a copy of your program and put it in your 3-ring binder

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The Salary Program:

Modify the program from the textbook (Program 1-1,see below) which

  • reads the number of hours an employee works
  • reads the pay rate per hour
  • computes the pay for the employee. 

Add the following steps:

a)    Read an amount of bonus paid to the employee.
b)    Compute the total pay as pay plus bonus.
c)    Compute the tax at 30% of the total pay.
d)    Compute the net pay as total pay minus tax, and

e)    Print a report showing: total pay, tax deduction, and net pay.

 

Algorithm:

1.    Prompt the user for number of hours.
2.    Read the value for hours.
3.    Prompt the user for hourly rate.
4.    Read the hourly rate.
5.    Prompt the user for amount of bonus.
6.    Read the value for bonus.
7.    Compute the pay.
8.    Compute the totalPay by adding bonus to pay.
9.    Compute the tax deduction by multiplying 30% times totalPay.
10. Compute the netPay by subtracting tax from totalPay.
11. Neatly print and label the following:

a.    totalPay

b.    tax

c.    netPay

Put your program on one of the PCs using a stand alone compiler such as Dev C++, or online compiler such as C++ shell. Name your program salary.cpp and save it on your cloud drive or flash drive after it works. You may write your complete program by hand first and document it as done in the sample class programs. Compile and run your program. It is recommended that you print a copy of your program and put it in your 3-ring binder.

 

Program 1-1

// This program calculates the user's pay.

#include <iostream>
using namespace std;

int main()
{
     double hours, rate, pay;

     // Get the number of hours worked.
     cout << "How many hours did you work? ";
     cin >> hours;
  
     // Get the hourly pay rate.
     cout << "How much do you get paid per hour? ";
     cin >> rate;
  
     // Calculate the pay.
     pay = hours * rate;
  
     // Display the pay.
     cout << "You have earned " << pay << endl;
     return 0;
}

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education