Your city’s Parking Violation Bu-reau wants you to write a program to compute fines for parking violations. There are four types of violation: type A carries a fine of $10, type B carries a fine of $20, type C carries a fine of $30, and type D carries a fine of $50. The program should ask for the name of offender, the number of type A violations, the number of type B violations, and so on. Store the offender’s name in a string object. The program should display the offender’s name and the total fine for the person.
1
Expert's answer
2016-04-12T15:06:04-0400
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string name; int A, B, C, D; Console.WriteLine("Enter the name of offender"); name = Convert.ToString(Console.ReadLine()); Console.WriteLine("Enter number of each type of violation"); Console.Write("Type A : "); A = int.Parse(Console.ReadLine()); Console.Write("Type B : "); B = int.Parse(Console.ReadLine()); Console.Write("Type C : "); C = int.Parse(Console.ReadLine()); Console.Write("Type D : "); D = int.Parse(Console.ReadLine()); Console.WriteLine("The name is total fine"); int total = A * 10 + B * 20 + C * 30 + D * 40; Console.WriteLine(name + " " + total+"$");
Comments
Leave a comment