CPPForSchool.com: Flow of Control Set 1: Assignment 3
3.
Write a program to calculate the total expenses. Quantity and price
per item are input by the user and discount of 10% is offered if the
expense is more than 5000.
For this assignment, I had to remember to use the precision function in order to ensure that the totals equate to dollar amounts, specifically the 0.00 format. This assignment was not too difficult because it calculated only 1 item type instead of numerous items. In essence, I had to merely account for one kind of product, but with multiple quantities. Also, the total of 5000+ would need to automatically calculate the price with the 10% discount. Below is my source code and test outputs.
For this assignment, I had to remember to use the precision function in order to ensure that the totals equate to dollar amounts, specifically the 0.00 format. This assignment was not too difficult because it calculated only 1 item type instead of numerous items. In essence, I had to merely account for one kind of product, but with multiple quantities. Also, the total of 5000+ would need to automatically calculate the price with the 10% discount. Below is my source code and test outputs.
Comments
Post a Comment