Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace FuelTank_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fuelType = Console.ReadLine();
- double fuelLittres = double.Parse(Console.ReadLine());
- string clubCard = Console.ReadLine();
- double gasolinePrice = 2.22;
- double dieselPrice = 2.33;
- double gasPrice = 0.93;
- double gasolineDisc = 0.18;
- double dieselDisc = 0.12;
- double gasDisc = 0.08;
- double totalPrice = 0.0;
- if (clubCard == "Yes")
- {
- switch (fuelType)
- {
- case "Gasoline":
- totalPrice = fuelLittres *( gasolinePrice - gasolineDisc);
- break;
- case "Diesel":
- totalPrice = fuelLittres * (dieselPrice * dieselDisc);
- break;
- case "Gas":
- totalPrice = fuelLittres * (gasPrice- gasDisc);
- break;
- }
- if (fuelLittres >= 20 && fuelLittres <= 25)
- {
- totalPrice *= 0.92;
- }
- else if (fuelLittres > 25)
- {
- totalPrice *= 0.9;
- }
- }
- else
- {
- switch (fuelType)
- {
- case "Gasoline":
- totalPrice = fuelLittres * gasolinePrice;
- break;
- case "Diesel":
- totalPrice = fuelLittres * dieselPrice;
- break;
- case "Gas":
- totalPrice = fuelLittres * gasPrice;
- break;
- }
- if (fuelLittres >= 20 && fuelLittres <= 25)
- {
- totalPrice *= 0.92;
- }
- else if (fuelLittres > 25)
- {
- totalPrice *= 0.9;
- }
- }
- Console.WriteLine($"{totalPrice:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement