C++ Program by Arriz John Villaflor, Ilao & Moreno

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

1.

#include <iostream>
2. using namespace std;
3. int main() {
4. cout << "Fuel Types and Rates:" << endl;
5. cout << "1. Kerosine - Php 52.00 per liter" << endl;
6. cout << "2. Diesel - Php 64.00 per liter" << endl;
7. cout << "3. Regular - Php 62.00 per liter" << endl;
8. cout << "4. Unleaded - Php 60.00 per liter" << endl;
9. cout << "5. Premium - Php 65.00 per liter" << endl;
10. cout << "Enter Fuel Code: ";
11. int fuelType;
12. cin >> fuelType;
13. double ratePerLiter = 52.00;
14. double totalBill = 0.0;
15. switch (fuelType) {
16. case 1:
17. case 2:
18. case 3:
19. case 4:
20. case 5: {
21. cout << "Enter the number of Liters: ";
22. double liters;
23. cin >> liters;
24. totalBill = ratePerLiter * liters;
25. cout << "Enter your membership code (1 for Regular, 2 for Premium, 0 for None): ";
26. int membershipCode;
27. cin >> membershipCode;
28. double discountRate = 0.0;
29. switch (membershipCode) {
30. case 1:
31. discountRate = 0.05;
32. break;
33. case 2:
34. discountRate = 0.10;
35. break;
36. case 0:
37. discountRate = 0.0;
38. break;
39. default:
40. cout << "Invalid membership code. No discount will be applied." << endl;
41. break;
42. }
43. double discountedAmount = totalBill * discountRate;
44. totalBill -= discountedAmount;
45. cout << "Fuel Type: " << fuelType << ", Liters: " << liters << endl;
46. cout << "Total Bill: Php " << totalBill << endl;
47. break;
48. }
49. default:
50. cout << "ERROR!!!" << endl;
51. break;
52. }
53. return 0;
54. }

SUBMITTED BY:

ARRIZ JOHN O. VILLAFLOR, HANNAH SHINE ILAO, AND JOHNA MORENO

SUBMITTED TO:

ENGR. JOHN MARK CABREROS

You might also like