Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int time,type,clock=600,fare=0;
  5. cout<<"Enter Time: 30 for 30 minutes, 60 for 60 minutes."<<endl;
  6. cin>>time;
  7. while (true){
  8. if(time!=30&&time!=60){
  9. cout<<"wrong time! try again"<<endl;
  10. cin>>time;
  11. }
  12. else break;
  13. }
  14. cout<<"Plane Type: 1 for 2 seater, 2 for 4 seater, 3 for historic plane."<<endl;
  15. cout<<"Enter Plane type"<<endl;
  16. cin>>type;
  17. while (true){
  18. if (type!=1&&type!=2&&type!=3){
  19. cout<<"Error: invalid plane type!"<<endl;
  20. cin>>type;
  21. }
  22. else break;
  23. }
  24.  
  25. if (time==30){
  26. while(clock>=30){
  27. if (type==3){
  28. fare+=300;
  29. clock-=60;
  30. }
  31. else if (type==1){
  32. fare+=100;
  33. clock-=60;
  34. }
  35. else if (type==2){
  36. fare+=120;
  37. clock-=60;
  38. }
  39. }
  40. }
  41. else if (time==60){
  42. while(clock>=60){
  43. if (type==3){
  44. fare+=500;
  45. clock-=90;
  46. }
  47. else if (type==1){
  48. fare+=150;
  49. clock-=90;
  50. }
  51. else if (type==2){
  52. fare+=200;
  53. clock-=90;
  54. }
  55. }
  56. }
  57. cout<<"Max. Fare: $"<<fare;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement