Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string months[] = { "january", "february", "march", "april", "may", "june",
  8. "july", "august", "september", "october", "november", "december" };
  9.  
  10. string month;
  11. int hours;
  12. int persons;
  13. double price;
  14. double pricePerPerson;
  15. double totalPrice;
  16. double regularPrice;
  17. string dayTime[] = { "day","night" };
  18. string time;
  19.  
  20. cin >> month >> hours >> persons >> time;
  21.  
  22. if(month == months[2] || month == months[3] || month == months[4]){
  23. if(time == dayTime[0]){
  24. price = 10.50;
  25.  
  26. }else{
  27. price = 8.4;
  28. }
  29. }
  30. else if(month == months[5] || month == months[6] || month == months[7]){
  31. if(time == dayTime[0]){
  32. price = 12.60;
  33.  
  34. }else{
  35. price = 10.20;
  36. }
  37. }
  38.  
  39. regularPrice = price * hours;
  40. pricePerPerson = regularPrice / (double)persons;
  41.  
  42. if(persons >= 4){
  43. pricePerPerson = pricePerPerson - (pricePerPerson * 0.1);
  44. }
  45.  
  46. if(hours >= 5){
  47. pricePerPerson = pricePerPerson - (pricePerPerson * 0.5);
  48.  
  49. }
  50.  
  51. totalPrice = pricePerPerson * hours * persons;
  52.  
  53. cout.setf(ios::fixed);
  54. cout.precision(2);
  55. cout << "Price per person for one hour: " << pricePerPerson <<endl;
  56. cout.setf(ios::fixed);
  57. cout.precision(2);
  58. cout << "Total cost of the visit: "<< totalPrice<<endl;
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. /*for(int i =0; i<12 ; i++){
  67.  
  68. cout << months[i] << endl;
  69.  
  70. }
  71.  
  72. */
  73.  
  74.  
  75. return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement