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;
- using System.Threading.Tasks;
- namespace beepboop
- {
- class Program
- {
- static void Main(string[] args)
- {
- double parkingCost = 0;
- int parkingHours = 0;
- Console.WriteLine("For how long was the car Parked?");
- parkingHours = Convert.ToInt32(Console.ReadLine()); // User enters parked hours and the program converts input (which is a string ) to an integer
- if (parkingHours > 20)
- {
- parkingCost = 20;
- }
- else
- {
- parkingCost = parkingHours * 2.5;
- }
- Console.WriteLine("Your parking ticket costs " + parkingCost + "$");
- Console.ReadKey(); // This is to not automatically close the program after outputting what the costs are.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement