Home CPSC 220

Total Calculation



To practice using file I/O and output formatting.


Your task for this lab is to write a program that reads in a number of floating point values from a file, adds them together, and then prints out the total.

It must also print out the sales tax on the total at a 5.3% rate, and the final total of the original items + sales tax.

The input is from a file called "items.txt" and the output should be to a file called "total.txt".




Sample Files

Here is a sample items.txt file.

Here is the output that should appear in total.txt.



When your program works, email the code to ifinlay@umw.edu.

Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.