It should contain a function prototype for function myname. The function receives a reference variable in the parameter list and returns void. The function myname will do the following: 1.1 Create a name string variable in the main function and initialize it with your full name as a string literal. Create a prototype indicating void return from the function and using pass by reference. Pass a reference to the name variable when calling the function in the main function. 1.2 The myname function use the reference variable in cout to print: Student Name: "full name that references the name string variable in the main function." 1.3 Advance to next line at the end of cout in the function. 2. In the main function of the C++ program, code program statements to do 2.3-2.9: 2.1 Download the attached savings.txt file. 2.2 Save the savings.txt file to a location on your computer where the program can read it. 2.3 The program should prompt to enter the filename. Save the filename to a variable and open the file for input. 2.4 In a loop, read the amounts including cents from the savings.txt file. The loop should end when there are no more records. 2.5 Accumulate the total and count the number of records read. Each record read is 1 day of savings. 2.6 When the total passes 500.00, send an output: "Your savings has reached $500.00 after x days." 2.7 Continue reading and accumulating the daily savings without output of 2.6. When the program finished reading all the records, calculate the average savings per day, and the total savings amount. 2.8 Send an output "You averaged $ xxx.xx savings per day and reached a total of $ xxxxxx.xx saved in nnn days." where x and n are numbers calculated by the program for average, total and count of records. 2.9 Lastly, call the myname() function (of Part 1) passing a reference to the name variable in the main.
1. It should contain a function prototype for function myname. The function receives a reference variable in the parameter list and returns void. The function myname will do the following:
1.1 Create a name string variable in the main function and initialize it with your full name as a string literal. Create a prototype indicating void return from the function and using pass by reference. Pass a reference to the name variable when calling the function in the main function.
1.2 The myname function use the reference variable in cout to print: Student Name: "full name that references the name string variable in the main function."
1.3 Advance to next line at the end of cout in the function.
2. In the main function of the C++
2.1 Download the attached savings.txt file.
2.2 Save the savings.txt file to a location on your computer where the program can read it.
2.3 The program should prompt to enter the filename. Save the filename to a variable and open the file for input.
2.4 In a loop, read the amounts including cents from the savings.txt file. The loop should end when there are no more records.
2.5 Accumulate the total and count the number of records read. Each record read is 1 day of savings.
2.6 When the total passes 500.00, send an output:
"Your savings has reached $500.00 after x days."
2.7 Continue reading and accumulating the daily savings without output of 2.6. When the program finished reading all the records, calculate the average savings per day, and the total savings amount.
2.8 Send an output
"You averaged $ xxx.xx savings per day and reached a total of $ xxxxxx.xx saved in nnn days."
where x and n are numbers calculated by the program for average, total and count of records.
2.9 Lastly, call the myname() function (of Part 1) passing a reference to the name variable in the main.
Hint: In this file processing, you can use cin as the file reader because the file contains only one column of numeric data with decimal positions.
savings.txt
35.00 63.15 12.5 10.00 8.25 7.50 8.00 100.25 25.00 25.15 280.50 244.10 120.00 100.00 78.50 55.00 55.20 13.55 12.00 18.95 12.15 10.00 58.55 25.60 8.50 10.00 12.00 50.50 19.25 45.60
(please do on code::Blocks)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images