Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. using static System.Console;
  2.  
  3. namespace CheckCredit
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. const double CreditCheck = 8000;
  10. string userInput;
  11. double price;
  12.  
  13. WriteLine("This is a program designed to check an item's price
  14. against your amount of available credit.");
  15. WriteLine("Your credit limit is $8,000.00.n");
  16.  
  17. do
  18. {
  19. Write("Please type the item's price:");
  20. userInput = ReadLine();
  21. if (!double.TryParse(userInput, out _))
  22. {
  23. WriteLine("Invalid input, please enter a whole or decimal number.");
  24. userInput = null;
  25. }
  26. } while (!double.TryParse(userInput, out price));
  27.  
  28. if (price > CreditCheck)
  29. {
  30. WriteLine(" You have exceeded the credit limit", price);
  31. }
  32.  
  33. else if
  34. (price == CreditCheck)
  35. {
  36. WriteLine(
  37. "Approved.(*)nnn"
  38. +
  39. "(*) It is exactly your credit limit.");
  40. }
  41. else
  42. {
  43. WriteLine("Approved.");
  44. }
  45. ReadKey();
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement