Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iomanip>
- #include <iostream>
- using namespace std;
- double calculateCharges(double h){
- if (h <= 3){
- return 2.00;
- }
- else
- {
- if (h < 24)
- return 2.00 + (h - 3) * 0.5;
- else{
- return 10.00;
- }
- }
- }
- int main(){
- double h = 0;
- double totalh = 0;
- double totalm = 0;
- while(h > -1){
- cout << "input the amount of hours the vehicle parked: ";
- cin >> h;
- cout << endl;
- cout << "This person pays: " << calculateCharges(h) << endl;
- totalh += h;
- totalm += calculateCharges(h);
- }
- cout << "the total time is: " << totalh << endl;
- cout << "the total $ is: " << totalm << endl;
- system("PAUSe");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement