Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace beepboop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double parkingCost = 0;
  14. int parkingHours = 0;
  15.  
  16. Console.WriteLine("For how long was the car Parked?");
  17. parkingHours = Convert.ToInt32(Console.ReadLine()); // User enters parked hours and the program converts input (which is a string ) to an integer
  18. if (parkingHours > 20)
  19. {
  20. parkingCost = 20;
  21. }
  22. else
  23. {
  24. parkingCost = parkingHours * 2.5;
  25. }
  26.  
  27. Console.WriteLine("Your parking ticket costs " + parkingCost + "$");
  28.  
  29. Console.ReadKey(); // This is to not automatically close the program after outputting what the costs are.
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement