Question

In: Computer Science

I will upvote fast! Please separate the program into 3 different modules, and have each module...

I will upvote fast!

Please separate the program into 3 different modules, and have each module called from main. Please use std::cin, std::cout  and nothing else.

PlEASE DO NOT USE:

  • Global variables
  • Selection statements, repetition statements, return statements (excepting the optional return 0; at the end of main), or arrays
  • The line using namespace std;
  • Inclusion of libraries that are specific to a particular operating system, or use of their commands
  • Calls to the system function

Please create a c++ program that does the following:

Enter employee's first name: Rachel
Enter employee's last name: Reins
Enter number of hours worked: 46.5
Enter hourly pay rate: 14.40

                             Hourly  Gross                    Net
Name                  Hours  Rate    Pay      Taxes   Deduct  Pay
====================  =====  ======  =======  ======  ======  =======
Reins, Rachel         46.50   14.40   669.60  200.88   10.00   458.72

taxes = 30% × gross_pay

net_pay = gross_paytaxes − $10.00

Solutions

Expert Solution

The program is given below: that contain 3 functions, take_input() function take fname, lname, hour_work and pay_rate from user, calculate() function calculate gross_pay, tax, net_pay, display() function print output, all 3 functions are called from main.

#include <iostream>
#include<iomanip>

using namespace std;
//take_input() function take fname, lname, hour_work and pay_rate from user
void take_input(string &fname,string &lname,double &hour_work,double &pay_rate)
{
//take fname from user
cout<<"Enter employee's first name: ";
cin>>fname;
//take lname from user
cout<<"Enter employee's last name: ";
cin>>lname;
//take hour_work from user
cout<<"Enter number of hours worked: ";
cin>>hour_work;
//take pay_rate from user
cout<<"Enter hourly pay rate: ";
cin>>pay_rate;
}
//calculate() function calculate gross_pay, tax, net_pay
void calculate(double hour_work,double pay_rate,double &gross_pay,double &tax,double &net_pay)
{
//calculate gross_pay, tax, net_pay
gross_pay=hour_work*pay_rate;
tax=(gross_pay*30)/100;
net_pay=gross_pay-tax-10;
}
//display() function print output
void display(string fname,string lname,double hour_work,double pay_rate,double gross_pay,double tax,double net_pay)
{
double deduct=10.00;
cout<<" "<<setw(22)<<"Hourly"<<setw(8)<<" "<<setw(8)<<"Gross"<<setw(8)<<" "<<setw(8)<<" "<<setw(8)<<"Net";
cout<<"\nName "<<setw(22)<<"Hours"<<setw(8)<<"Rate"<<setw(8)<<"Pay";
cout<<setw(8)<<"Taxes"<<setw(8)<<"Deduct"<<setw(8)<<"Pay";
cout<<"\n==================== ===== ====== ======= ====== ====== =======";
cout<<"\n"<<lname<<", "<<fname;
cout<<setw(14)<<fixed<<setprecision(2)<<hour_work;
cout<<setw(8)<<pay_rate;
cout<<setw(8)<<gross_pay;
cout<<setw(8)<<tax;
cout<<setw(8)<<deduct;
cout<<setw(8)<<net_pay;
}
int main()
{
string fname,lname;
double hour_work,pay_rate,gross_pay,tax,net_pay;
//call take_input() function
take_input(fname,lname,hour_work,pay_rate);
//call calculate() function
calculate(hour_work,pay_rate,gross_pay,tax,net_pay);
//call display() function that display output
display(fname,lname,hour_work,pay_rate,gross_pay,tax,net_pay);
return 0;
}

The screenshot of code is given below:

Output:


Related Solutions

Which of the following statements about Statutory Accounting Principles is FALSE? I will upvote the fast...
Which of the following statements about Statutory Accounting Principles is FALSE? I will upvote the fast and accurately reliable answer Insurers can fully recognize written premiums as earned revenue to minimize their insolvency risk. Because SAP strives to disclose financial information related to insurer insolvency, the statutory income (loss) amounts on income statements are often unreliable indicators of insurer profitability. Insurers can only include certain type of assets on their balance sheets, which are called admitted assets. Underwriting expenses are...
Please answer as soon as possible, I will upvote if it is answered in 40 minutes....
Please answer as soon as possible, I will upvote if it is answered in 40 minutes. Suppose that a bond portfolio with a duration of 5 years is hedged using a futures contract in which the underlying asset has a duration of 14 years. What is likely to be the impact on the hedge of the fact that the 14-year rate is less volatile than the 5-year rate?
Please answer this question with explanation. I will upvote your answer if it is correct and...
Please answer this question with explanation. I will upvote your answer if it is correct and clear. Thank you! You are given a positive integer n of the form n = 2h − 1, for some integer h ≥ 1. Give an example of an array of length n where the following method of building a heap step 1. Place the new key at the first free leaf step 2. The heap-order property might be violated: perform a bubble-up, uses...
Please explain this, I will 100% upvote! Elam, a contractor, just signed a contract with a...
Please explain this, I will 100% upvote! Elam, a contractor, just signed a contract with a developer to provide services in a new home development. The developer has agreed to pay Elam $15,000 up front (today) 30,000 in two years and another $50,000 five years from today. Elam anticipates costs of $7,000 three years from today and another $25,000 eight years from today. What is the total value of the contract to Elam if the interest rate is 3.7% Answer...
Please answer both parts for upvote part a) Consider the shape of the distribution of each...
Please answer both parts for upvote part a) Consider the shape of the distribution of each of the following scenarios. For each, answer the following questions: Scenario 1 - The heights of female adults in Halifax Scenario 2 - The average number of children that Canadian families have. For each, answer the following questions: 1. What shape would you expect the distribution to have, and why? 2. If we randomly select a sample of 25 from that population, would the...
Using the concepts from the Concurrency Basics Tutorial I provided in Modules, write a program that...
Using the concepts from the Concurrency Basics Tutorial I provided in Modules, write a program that consists of two threads. The first is the main thread that every Java application has. The main thread should create a new thread from the Runnable object, MessageLoop, and wait for it to finish. If the MessageLoop thread takes too long to finish, the main thread should interrupt it. Use a variable named maxWaitTime to store the maximum number of seconds to wait. The...
please i want find that in R program very fast find maxlike ,moment and probability weighed...
please i want find that in R program very fast find maxlike ,moment and probability weighed moment’s method for gumbel distrbution ( n=50,mu= 2,beta=4) N= 1000 maxlikhood=mle moment =mm pwm=Probability weighed moment’s method i want to use R studo program find estimtate prarmeter to all method also bias and MsE
I have designed a two part discussion question this module. Please make sure to comment sufficiently...
I have designed a two part discussion question this module. Please make sure to comment sufficiently on both questions. Make sure that your initial response to the question contains at least 2 cited academic sources to support the ideas that you raise. (1) In considering various forms of psychopathology researchers have often focused on the role of social and psychological variables. In recent years, however, many studies have been conducted which have investigated the role of biological factors as they...
How do you use header files on a program? I need to separate my program into...
How do you use header files on a program? I need to separate my program into header files/need to use header files for this program.Their needs to be 2-3 files one of which is the menu. thanks! #include #include #include using namespace std; const int maxrecs = 5; struct Teletype { string name; string phoneNo; Teletype *nextaddr; }; void display(Teletype *); void populate(Teletype *); void modify(Teletype *head, string name); void insertAtMid(Teletype *, string, string); void deleteAtMid(Teletype *, string); int find(Teletype...
C++ program to perform each of the area calculations in separate functions. Your program will take...
C++ program to perform each of the area calculations in separate functions. Your program will take in the relevant information in the main (), call the correct function that makes the calculation, return the answer to the main () and then print the answer to the screen. The program will declare a variable called “choice” of type int that is initialized to 0. The program will loop while choice is not equal to 4. In the body of the loop...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT