Department the person works in

Assignment Help Basic Computer Science
Reference no: EM131848551

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 <iostream>

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;

}

Reference no: EM131848551

Questions Cloud

Research the history of the pipe and filter style of command : Research the history of the pipe and filter style of commands. In a 2- to 3-page report, explain the strengths and limitations of the approach.
Source arrays into an ordered destination array : For the OrdArray class in the orderedArray.java program (Listing 2.4 on page 59), you are asked to add the following methods
What will be approximate capital gain of this bond : what will be the approximate capital gain of this bond over the next year if its yield to maturity remains unchanged?
Research potential hris types and hris vendors : Research potential HRIS types and HRIS vendors that may suit the needs for Mr. Bell and Gladwell Grocery Stores.
Department the person works in : The first line contains a person's first name, last name, and the department the person works in.
Evaluates difference between leadership and board governance : Write a 700- to 1,050-word paper that evaluates the difference between leadership and board governance in establishing strategic planning for a health care orga
Discuss about the traditional hierarchy organization : Write an original research report consisting of one of the following topic areas: 1) Traditional Hierarchy organization; 2) Holacratic organizations etc.
Explain the importance of system development life cycles : Explain the importance of system development life cycles. Begin the discussion with an overview of systems development.
Full mesh and partial mesh in ospf configuration : What is the different between full mesh and partial mesh in ospf configuration over frame relay?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Possesses some finite amount of magical energy

A spellcaster is given an object (e.g. mouse, owl, dwarf, purse ...) and a set of spells that she / he can use to transform the object. The effect of each spell is described by a set of from-to pairs. For example, spell "Chiroptera" may transform ob..

  Determine the net rate power is developed

A power cycle receives energy by heat transfer from the combustion of fuel at a rate of 300 MW. The thermal efficiency of the cycle is 33.3%.

  Show that the dual problem is feasible

Hint: Assume without loss of generality that the primal is feasible (take si = 0 if necessary), and note that all forward cycles have nonnegative cost if and only if the primal problem is not unbounded (see the discussion near the beginning of Sec..

  Which can cause a violation of the foreign key constraint

Consider the foreign key constraint from the dept name attribute of instructor to the department relation.

  Find a number alpha mod 8745437489 is not a primitive root

using a computer, show that 7 is a primitive root mod 8745437489. Find a number alpha mod 8745437489 that is not a primitive root

  What is the minimum value of p necessary to meet your goal

What is the minimum value of p necessary to meet your goal.

  Construct a model-theoretic interpretation

Draw a predicate dependency graph for the above predicates. (Note: DURATION(X, Y, Z) means that you can take a flight from X to Y in Z hours.)

  Executive proposal project

The purpose of this project is to evaluate the student's ability to research and evaluate security testing software and present a proposal for review

  Question about flight function

An airline vice president in charge of operations requires to determine whether the current estimates of flight times are accurate. because there is a larger possiblity of variations due to wether and air traffic in the longer flights.

  Constitutional right to disobey a directive

Hypothesize a situation in which a public administrator or employee should have the constitutional right to disobey a directive ordered by a superior.

  Show how the minimum cost flow problem can be transformed

where all node supplies are zero except for one node that has positive supply and one node that has negative supply

  Utilize a constant called taxrate to hold the tax rate

Program should read in a file called "sales.txt". The contents of the text file are below. Read in all data from the file. Sore units in integers and store sales in doubles.The first integer is the first unit sales. The first double is the first $ o..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd