Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Suppose that the file inData.txt contains the following data:

Giselle Robinson Accounting
5600 5 30
450 9
75 1.5

The first line contains a person's first name, last name, and the department the person works in.

In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent).

The third line contains the distance traveled and the traveling time.

The fourth line contains the number of coffee cups sold and the cost of each coffee cup.

Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results.

Write statements that close the input and output files.

The file inData.txt is provided for you with the following data:

 Giselle Robinson Accounting
5600 5 30
450 9
75 1.5

Run your program, and ensure that outData.txt is created and has the following lines:

Name: Giselle Robinson, Department: Accounting

Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxes: 30.00%

Paycheck: $4116.00

Distance Traveled: 450.00 miles, Traveling Time: 9.00 hours

Average Speed: 50.00 miles per hour

Number of Coffee Cups Sold: 75, Cost: $1.50 per cup

Sales Amount = $112.50

#include

using namespace std;

int main() {

   double distancetravel, travelTime, averageSpeed;

   int numofCoffeeCupSold;

   double coffeeCupcost, salesAmount;

   ifstream inFile;

   ofstream outFile;

   infile.open("inData.txt");

   outFile.open("outData.txt");

   string firstName, lastName, department;

   double grossSalary, bonus, taxRate, bonusPercent, taxRatepercent, payCheck;

   outFile << "Please enter your first name, last name, and department" << endl;

   inFile >> firstName >> lastName >> department;

   cout << "Please enter your gross salary, bonus, and tax rate" << endl;

   inFile >> grossSalary >> bonus >> taxRate;

   bonus = grossSalary * bonusPercent/100;

   taxRate = grossSalary * (taxRatepercent/100);

   payCheck = grossSalary - bonus - taxRate;

   outFile << firstName << lastName << department << endl;

    outFile << "The bonus is " << payCheck << endl;

    outFile << "The tax rate is " << taxRate;

   outFile << "Enter number of coffee cups sold and the coffee cup cost" << endl;

   inFile >> numofCoffeeCupsSold >> coffeeCupcost;

   salesAmount = numofCoffeeCupsSold * coffeeCupcost;

   outFile << "Number of Cofee Cup Sold" << numofCoffeeCupsSold

       << ", cost : $" << coffeeCupCost << "per cup" << endl;

   outFile << "Sales Amount = $" << salesAmount << endl;

   return 0;

}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92676910
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question a supervisor states integration testing is a waste

Question : A supervisor states, "Integration testing is a waste of time. If each program is tested adequately, integration testing is not needed. Instead, we should move on to system testing as soon as possible. If modul ...

Question suppose we iterate the application of a blurring

Question : Suppose we iterate the application of a blurring filter with kernel size 5 on an image of 800 times 600 pixels. How many times should we apply the filter for the color of the pixel at position (20, 20) to be i ...

Biodiversity refers to the variety of living organisms

Biodiversity refers to the variety of living organisms found within an ecosystem. In your description, evaluate the role of humans in the current biodiversity loss situation and increased species extinction rate. In addi ...

Calculate the thinkness of the monolayer assuming that the

Calculate the thinkness of the monolayer assuming that the volume of the monolayer is 7.39×10-6 mL and diameter of the watch glass is 5 cm.

Question have you received emails like thesewhat actions if

Question : Have you received emails like these? What actions, if any, have you taken to limit the permissions of the sender? Why or why not? In your chapter reading, you learned about the CAN-SPAM law From your perspecti ...

What would be examples of valid selection methods used by

What would be examples of valid selection methods used by the human resource department to ensure selecting the appropriate candidate for a job.

Consider two computer companies - orange and ph - that

Consider two computer companies - Orange and PH - that report current sales receipts of $323 million and $294 million, respectively. Their cur-rent operating expenses were $150 million each. Orange issued $5 million in n ...

Show how an 8x1 multiplexer can be constructed from 4x1

Show how an 8x1 multiplexer can be constructed from 4x1 multiplexers and 2x1 multiplexers and no logic gates.

Compare and contrast static and dynamic efficiency applied

Compare and contrast static and dynamic efficiency applied to the fossil fuel market. Compare and contrast the concepts of resource rent and user cost as applied to this market and the potential differences in optimal ar ...

Sorting program note make sure you use c programming

Sorting Program Note: Make sure you use c++ programming otherwise i will not grade your work For this assignment, you are to write a comparative algorithm that will compare the efficiency of three sorting routines. Here ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As