Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

numbers in file: (random number for 30 days 35.00 63.00 12.5 10.00 244.10 280.50 14.00 12.30 300.04... . . 12.3 QUESTION 1 In this part

image text in transcribed
image text in transcribed
numbers in file: (random number for 30 days
35.00
63.00
12.5
10.00
244.10
280.50
14.00
12.30
300.04...
.
.
12.3
QUESTION 1 In this part II of the exam, please create a C++ program named savings.cpp that fulfillst following requirements 1. (10 points) It should contain a function prototype for function myname. The function receives a reference variable in the parameter list and returns void. The function mynar do the following 1.1 Create a name string variable in the main function and initialize it with your full name string literal. Create a prototype indicating void return from the function and using passt 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. (20 points) in the main function of the C++ program, code program statements to do 2.3 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 en when there are no more records. 2.5 Accumulate the total and count the number of records read. Each record read is 1 day 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 S xxx.xx savings per day and reached a total of S 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 mynamed function (of Part 1) passing a reference to the name variable in the main. Hint: In this file processing, you can use in as the file reader because the file contains only one column of numeric data with decimal positions, To submit: 1. Upload the mysavings.cpp program. 2. A second question in Exam 1 Part 2 is for uploading the image of your run and output. Click Save and Submit to save and submit. Click Save As to save all answers Save All Question Completion Status: QUESTION 1 30 points In this part of the exam, please create a C++ program named savings.cpp that fulfills the following requirements 1. (10 points) 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. (20 points) 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 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 innnn days. where x and nare numbers calculated by the program for average total and count of records 2.9 Lastly call the mynamed function of Part 1) passing a reference to the name variable in the main. Hints in this file processing, you can use in as the file reader because the file contains only one column of numeric data with decimal positions. To submit 1. Upload the mysavings.cpp program 2. A second question in Exam 1 Part 2 is for uploading the image of your run and output Click Save and submit to save and submit Chek Satie Al Answers to see all answers Save and

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

Different formulas for mathematical core areas.

Answered: 1 week ago