develop a C objectoriented solution to determine The custome

develop a C# object-oriented solution to determine:

The customers who have exceeded the limit of $300.00 on their accounts, and

The suppliers to whom Millers owes more than $400.00

The Millers store keeps the following information for each customer:

Customer name (must be between 4 and 20 characters)

Account number (must be 5 digits and start with digit ‘1’)

Amount owing by the customer to Millers ($) at the beginning of a particular month

(>= 0)

Total of purchases ($) from Millers by this customer for the month

Total of all payments ($) made by this customer to Millers in this month; no overpayments are to be made

Amount owing to Millers ($) at the end of the month

The Millers store keeps the following information for each supplier:

Supplier name (must be between 4 and 20 characters)

Account number (must be 5 digits and start with digit ‘2’)

Account balance ($) at the beginning of a particular month; amount owing by Millers to the supplier ( >= 0 )

Total of all purchases ($) from this supplier by Millers this month

Total of all payments ($) made by Millers to this supplier this month

Amount owing ($) at the end of the month by Millers to the supplier

Program input:

The program should take the following input in the order given, and by using the appropriate prompts:

Check if the user wishes to track any customer’s status, and if so:

the number of customers whose details must be entered (the program must allow for any number of customers)

the details of customers (items (a)-(e) specified on page 1 for customers), customer by customer, using appropriate identifiers for each customer (e.g. First Customer , Second Customer, etc.)

Check if the user wishes to track any supplier’s status, and if so:

the number of suppliers whose details must be entered (the program must allow for any number of suppliers)

the details of suppliers (items (a)-(e) specified on page 1 for suppliers), supplier by supplier, using appropriate identifiers for each supplier (e.g. First Supplier, Second Supplier, etc.)

Note:

You are required to create three classes, one for customer, one for supplier, and one application class for creating the necessary objects.

The program must generate an appropriate error message if any input does not follow the required criteria and then request the user to re-enter the input.

Program output:

The program should display all the account numbers with the corresponding account balances at the end of the month for all customers and suppliers, and   

For any customer whose balance at the end of the month exceeds that customer\'s credit limit of $300.00, the program should display the message: \"Credit limit exceeded.\"

For any supplier to whom Millers owes more than $400.00 at the end of the month, the program should display the message: “Payment of this account is due now.\"

Note:

The output must be displayed in a tabular format.

Test your code using appropriate test data to cover all possible scenarios.

Solution

using System;

namespace StoreApplication
{
    public class Customer
    {
        String CustomerName; //(must be between 4 and 20 characters)
        String AccountNumber;// (must be 5 digits and start with digit ‘1’)
//Amount owing by the customer to Millers ($) at the beginning of a particular month
//(>= 0)
double initBalance;
//Total of purchases ($) from Millers by this customer for the month
double totalPurchase;

//Total of all payments ($) made by this customer to Millers in this month;
//no overpayments are to be made
double totalPayment;
//Amount owing to Millers ($) at the end of the month
double endBalance;
        public Customer(String name, String num, double init,double purchase, double payment)
        {
            CustomerName=name;
            AccountNumber=num;
            initBalance=init;
            totalPurchase=purchase;
            totalPayment=payment;
            endBalance=initBalance+totalPayment-totalPurchase;
            if(endBalance>300.0)
                Console.WriteLine(\"Credit limit exceeded.\");
        }
        public void print()
        {
            Console.WriteLine(CustomerName+\" \"+AccountNumber+\" \"+initBalance+\" \"+totalPurchase+\" \"+totalPayment+\" \"+endBalance);
        }
    }
    
    public class Supplier
    {
        String SupplierName; //(must be between 4 and 20 characters)
        String AccountNumber;// (must be 5 digits and start with digit ‘1’)
//Amount owing by the customer to Millers ($) at the beginning of a particular month
//(>= 0)
double initBalance;
//Total of purchases ($) from Millers by this customer for the month
double totalPurchase;

//Total of all payments ($) made by this customer to Millers in this month;
//no overpayments are to be made
double totalPayment;
//Amount owing to Millers ($) at the end of the month
double endBalance;
        public Supplier(String name, String num, double init,double purchase, double payment)
        {
            SupplierName=name;
            AccountNumber=num;
            initBalance=init;
            totalPurchase=purchase;
            totalPayment=payment;
            endBalance=initBalance+totalPayment-totalPurchase;
            if(endBalance>400.0)
                Console.WriteLine(\"Payment of this account is due now.\");
            
        }
        public void print()
        {
            Console.WriteLine(SupplierName+\" \"+AccountNumber+\" \"+initBalance+\" \"+totalPurchase+\" \"+totalPayment+\" \"+endBalance);
        }
    }
    
    class Program
    {
        public static void Main(string[] args)
        {
            int n;
            Console.WriteLine(\"Enter number of customers: \");
            n=Convert.ToInt32(Console.ReadLine());
            Customer []customers=new Customer[n];
            for(int i=0;i<n;i++)
            {
                Console.WriteLine(\"Enter name, accnumber, initbalance, purchase, payment of Customer \"+(i+1));
                customers[i]=new Customer(Console.ReadLine(),Console.ReadLine(),Convert.ToDouble(Console.ReadLine()),Convert.ToDouble(Console.ReadLine()),Convert.ToDouble(Console.ReadLine()));
                
            }
            
            int nn;
            Console.WriteLine(\"Enter number of Suppliers: \");
            nn=Convert.ToInt32(Console.ReadLine());
            Supplier []suppliers=new Supplier[nn];
            for(int i=0;i<nn;i++)
            {
                Console.WriteLine(\"Enter name, accnumber, initbalance, purchase, payment of Supplier \"+(i+1));
                suppliers[i]=new Supplier(Console.ReadLine(),Console.ReadLine(),Convert.ToDouble(Console.ReadLine()),Convert.ToDouble(Console.ReadLine()),Convert.ToDouble(Console.ReadLine()));
            }
            
            //display
            Console.WriteLine(\"Customer details\");
            for(int i=0;i<n;i++)
                customers[i].print();
            Console.WriteLine(\"Supplier details\");
            for(int i=0;i<nn;i++)
                suppliers[i].print();
            Console.Write(\"Press any key to continue . . . \");
            Console.ReadKey(true);
        }
    }
}

develop a C# object-oriented solution to determine: The customers who have exceeded the limit of $300.00 on their accounts, and The suppliers to whom Millers ow
develop a C# object-oriented solution to determine: The customers who have exceeded the limit of $300.00 on their accounts, and The suppliers to whom Millers ow
develop a C# object-oriented solution to determine: The customers who have exceeded the limit of $300.00 on their accounts, and The suppliers to whom Millers ow
develop a C# object-oriented solution to determine: The customers who have exceeded the limit of $300.00 on their accounts, and The suppliers to whom Millers ow

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site