Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace ProblemTwoExam
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- List<string> myList = Console.ReadLine()
- .Split(">>",StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- decimal tax = 0.00m;
- decimal nationalRevenueAgency = 0.00m;
- for (int i = 0; i < myList.Count; i++)
- {
- string[] tokens = myList[i].Split(' ');
- switch (tokens[0])
- {
- case "family":
- tax = int.Parse(tokens[2]) / 3000 * 12 + (50 - int.Parse(tokens[1]) * 5);
- nationalRevenueAgency += tax;
- Console.WriteLine($"A {tokens[0]} car will pay {tax:f2} euros in taxes.");
- tax = 0.00m;
- break;
- case "heavyDuty":
- tax = int.Parse(tokens[2]) / 9000 * 14 + (80 - int.Parse(tokens[1]) * 8);
- nationalRevenueAgency += tax;
- Console.WriteLine($"A {tokens[0]} car will pay {tax:f2} euros in taxes.");
- tax = 0.00m;
- break;
- case "sports":
- tax = int.Parse(tokens[2]) / 2000 * 18 + (100 - int.Parse(tokens[1]) * 9);
- nationalRevenueAgency += tax;
- Console.WriteLine($"A {tokens[0]} car will pay {tax:f2} euros in taxes.");
- tax = 0.00m;
- break;
- }
- if (tokens[0] != "family" && tokens[0] != "heavyDuty" && tokens[0] != "sports")
- {
- Console.WriteLine("Invalid car type.");
- }
- }
- Console.WriteLine($"The National Revenue Agency will collect {nationalRevenueAgency:f2} euros in taxes.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement