Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. /*When snow depth exceeds 0.65 inches on trunklines and 1.25 inches on Major Streets and 2.75 inches on Local streets
  2. City crews will start plowing and/or salting City streets.
  3. Crews will start plowing the local streets as soon as the trunklines and major streets are complete
  4.  
  5. If the temperature is below 8 degrees then salting will not be done.
  6.  
  7. */
  8.  
  9.  
  10.  
  11.  
  12.  
  13. #include<iostream>
  14. using namespace std;
  15.  
  16. int main()
  17. {
  18. float temp,snw;
  19. char street;
  20. bool salt,snow;
  21.  
  22. cout << "Metropolis 2020 Winter Street Treatment Designation";
  23. cout << "\n\nWhat is the temperature in degrees(F)? ";
  24. cin >> temp;
  25. cout << "How much new Snow depth (in inches)? ";
  26. cin >> snw;
  27. cout << "The Street designations are T-Trunkline M-Major Street L-Local";
  28. cout << "\nWhich do you choose (T,M,L)? ";
  29. cin >> street;
  30.  
  31. if (temp <= 8.0) salt = false; else salt = true; //bool if salt is done or not
  32.  
  33. switch(street)
  34. {
  35. case 'T':
  36. if(snw >= 0.65)
  37. if(salt == 1)
  38. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation.\nTrunklines will be Plowed and Salted.",temp,snw);
  39. else
  40. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation.\nTrunklines will be Plowed and not Salted.",temp,snw);
  41. else
  42. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation. \nTrunklines will not be Plowed and not Salted.",temp,snw);
  43. break;
  44.  
  45. case 'M':
  46. if(snw >= 1.25)
  47. if(salt == 1)
  48. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation.\nMajor Streets will be Plowed and Salted.",temp,snw);
  49. else
  50. printf("Given the temperature is %.f degrees and %f inches of snow accumulation.\nMajor Streets will be Plowed and not Salted.",temp,snw);
  51. else
  52. printf("Given the temperature is %.f degrees and %f inches of snow accumulation.\nMajor Streets will not be Plowed and not Salted.",temp,snw);
  53. break;
  54.  
  55. case 'L':
  56. if(snw >= 2.75)
  57. if(salt == 1)
  58. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation.\nLocal Streets will be Plowed and Salted.",temp,snw);
  59. else
  60. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation.\nLocal Streets will be Plowed and not Salted.",temp,snw);
  61. else
  62. printf("Given the temperature is %.f degrees and %.3f inches of snow accumulation.\nLocal Streets will not be Plowed and not Salted.",temp,snw);
  63. break;
  64.  
  65. default: cout << "Invalid Street designation";
  66. }
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement