Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using static System.Console;
- namespace CheckCredit
- {
- class Program
- {
- static void Main(string[] args)
- {
- const double CreditCheck = 8000;
- string userInput;
- double price;
- WriteLine("This is a program designed to check an item's price
- against your amount of available credit.");
- WriteLine("Your credit limit is $8,000.00.n");
- do
- {
- Write("Please type the item's price:");
- userInput = ReadLine();
- if (!double.TryParse(userInput, out _))
- {
- WriteLine("Invalid input, please enter a whole or decimal number.");
- userInput = null;
- }
- } while (!double.TryParse(userInput, out price));
- if (price > CreditCheck)
- {
- WriteLine(" You have exceeded the credit limit", price);
- }
- else if
- (price == CreditCheck)
- {
- WriteLine(
- "Approved.(*)nnn"
- +
- "(*) It is exactly your credit limit.");
- }
- else
- {
- WriteLine("Approved.");
- }
- ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement