Answer to Question #132446 in C# for Dennis

Question #132446
Write C# application program to be used to evaluate the credit worthy of a client. The program reads the credit limit and the price and quantity of the item to be purchased by the client. If the value of the goods is more than the credit limit, the program displays “Sorry you cannot purchase goods worthy such a value on credit” and allows the customer to re-enter the quantity, otherwise, displays “Thank You for purchasing from us” and the value of the purchase. This should be repeated for n customers.
4).
1
Expert's answer
2020-09-10T13:50:23-0400
using System;


namespace Credit
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            Console.Write("n = ");
            n = int.Parse(Console.ReadLine());


            for(int i = 0; i < n; i++)
            {
                double creditLimit;
                Console.Write("Credit limit:");
                creditLimit = double.Parse(Console.ReadLine());


                double price;
                Console.Write("Enter price:");
                price = double.Parse(Console.ReadLine());


                int quantity;


                do
                {
                    Console.Write("Enter quantity:");
                    quantity = int.Parse(Console.ReadLine());


                    double purchase = quantity * price;


                    if (purchase > creditLimit)
                    {
                        Console.WriteLine("Sorry you cannot purchase goods worthy such a value on credit");
                    }
                    else
                    {
                        Console.WriteLine("Thank You for purchasing from us");
                        break;
                    }


                } while (true);
                
            }


            Console.ReadKey();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS