[SOLVED] CS150 Lab 12

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Lab-12-mdb6zs.zip (494.4 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Have the user input a filename to read in ints from. Print each to the screen, one per line and keep a running total.
Print the total at the end. If the file does not exist say so and do not print the total.
Test Case 1:
File contents (ask user to enter filename, the file they enter contains this): 2 4 6 8 10
Sample output:
Read 2 from file. Read 4 from file.
Read 6 from file.
Read 8 from file.
Read 10 from file.
Total is 30.Test Case 2:
File contents (ask user to enter filename, the file they enter contains this):
1
3
5
7
Sample Output:
Read 1 from file.
Read 3 from file.
Read 5 from file.
Read 7 from file.
Total is 16.
Test Case 3:
(nonexistent file – user enters nonexistent filename)
Sample output:
Failed to open file.

  • Lab-12-mdb6zs.zip