Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int time,type,clock=600,fare=0;
- cout<<"Enter Time: 30 for 30 minutes, 60 for 60 minutes."<<endl;
- cin>>time;
- while (true){
- if(time!=30&&time!=60){
- cout<<"wrong time! try again"<<endl;
- cin>>time;
- }
- else break;
- }
- cout<<"Plane Type: 1 for 2 seater, 2 for 4 seater, 3 for historic plane."<<endl;
- cout<<"Enter Plane type"<<endl;
- cin>>type;
- while (true){
- if (type!=1&&type!=2&&type!=3){
- cout<<"Error: invalid plane type!"<<endl;
- cin>>type;
- }
- else break;
- }
- if (time==30){
- while(clock>=30){
- if (type==3){
- fare+=300;
- clock-=60;
- }
- else if (type==1){
- fare+=100;
- clock-=60;
- }
- else if (type==2){
- fare+=120;
- clock-=60;
- }
- }
- }
- else if (time==60){
- while(clock>=60){
- if (type==3){
- fare+=500;
- clock-=90;
- }
- else if (type==1){
- fare+=150;
- clock-=90;
- }
- else if (type==2){
- fare+=200;
- clock-=90;
- }
- }
- }
- cout<<"Max. Fare: $"<<fare;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement