Created
March 10, 2019 07:17
-
-
Save AndrewS097/8895d6839f7b90908cbcc18ad6eade33 to your computer and use it in GitHub Desktop.
Panther Cashier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
int main() { | |
string name1, name2, name3; | |
int price1, price2, price3, quantity1, quantity2, quantity3,sum1,sum2, sum3, beforetax, payment, change_math; | |
double change, taxrate, totalprice; | |
cout << "Unit Name: "; | |
cin >> name1; | |
cout << "Unit Price for " << name1 << " : "; | |
cin >>price1; | |
cout << "Unit Quantity for " << name1 << " : "; | |
cin >> quantity1; | |
cout << endl; | |
cout << "Unit Name: "; | |
cin >> name2; | |
cout << "Unit Price for " << name2 << " : "; | |
cin >>price2; | |
cout << "Unit Quantity for " << name2 << " : "; | |
cin >> quantity2; | |
cout << endl; | |
cout << "Unit Name: "; | |
cin >> name3; | |
cout << "Unit Price for " << name3 << " : "; | |
cin >>price3; | |
cout << "Unit Quantity for " << name3 << " : "; | |
cin >> quantity3; | |
cout << endl; | |
cout << "What is the tax rate: (in whole numbers) "; | |
cin >> taxrate; | |
sum1=quantity1*price1; | |
sum2=quantity2*price2; | |
sum3=quantity3*price3; | |
beforetax = sum1+sum2+sum3; | |
cout << "Total before tax " << beforetax <<endl; | |
cout << endl; | |
taxrate= taxrate*0.01; | |
totalprice= (beforetax*taxrate)+beforetax; | |
cout << "Total after tax " << totalprice <<endl; | |
cout << endl; | |
cout << "What is your payment? "; | |
cin >> payment; | |
change= payment-totalprice; | |
cout <<"Your change is: " << change <<endl; | |
change_math= change*100; | |
cout << "100 dollars " << round(change_math/10000) <<endl; | |
change_math=change_math%10000; | |
cout << "50 dollars " << round(change_math/5000)<<endl; | |
change_math=change_math%5000; | |
cout << "20 dollars " << round(change_math/2000)<<endl; | |
change_math=change_math%2000; | |
cout << "10 dollars " <<round(change_math/1000)<<endl; | |
change_math=change_math%1000; | |
cout << "5 Dollars " <<round(change_math/500)<<endl; | |
change_math=change_math%500; | |
cout << "Dollars " <<round(change_math/100)<<endl; | |
change_math=change_math%100; | |
cout << "Quarters " <<round(change_math/25)<<endl; | |
change_math=change_math%25; | |
cout << "Dimes: " <<round(change_math/10)<<endl; | |
change_math=change_math%10; | |
cout << "Nickels " << round(change_math/5)<<endl ; | |
change_math=change_math%5; | |
cout << "Pennies " << round(change_math/1)<<endl; | |
change_math=change_math%1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment