Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The objective of this Exercise is to demonstrate the use of a file for data input. Write a program for a payroll calculation: given a
The objective of this Exercise is to demonstrate the use of a file for data input. Write a program for a payroll calculation: given a name, hours worked, and an hourly wage, calculate and print the total amount earned in a sentence. Your output might look something like the following: arriette Roadman xercise 4 an 23. 2016 ata is being read fron file exAdata.txt ile contains: nane (single word), hours worked float), Wage (float. in dollars per hour) amantha uorked 24.50 hours at $?.85 per hour and earned $192.32 for the ueek ress any key to continue.. . This data file was used for input to the program that produced the output shown above: ex4data-Notepad Eile Help File contains name (single word), hours worked (loat), wage (float, in dollars per hour) Samantha 24.5 .85 to note Please review the documents File Creation and File Input & Output. You will need to create a data file to use for input. You will choose the name of the input file. You might use something like "ex4data txt" For this Exercise you should set up the input file to contain at least 4 lines of data: First line:information on how the file is set up Second line: a name (either one word, or several words, but must be character data) Third line: a value for hours worked, should be a decimal number Fourth line: a value for hourly wage, no S included, should be a decimal number Write your code to read the values from the input file, including the first line, calculate the wage, and print the information requested. Your output doesn't need to be identical to what is shown, but it does need to have the ame content The input values are echoed as part of the wage sentence. Be sure to: use#include print the file name include a S sign in the cout statement for the hourly wage as well as for the total earnings. use cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started