Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment6_yourlastname.cs] Implement the following requirements: Create a clas

ID: 638209 • Letter: A

Question

Assignment6_yourlastname.cs] Implement the following requirements:

Create a class named Customer that implements IComparable interface.

Create 3 Customer class fields: Customer number, customer name, and amount due. Create automatic accessors for each field.

Create an Customer class constructor that takes parameters for all of the class fields and assigns the passed values through the accessors.

Create a default, no-argument Customer class constructor that will take no parameters and will cause default values of (9, "ZZZ", 0) to be sent to the 3-argument constructor.

Create an (override) Equals() method that determines two Customers are equal if they have the same Customer number.

Create an (override) GetHashCode() method that returns the Customer number.

Create an (override) ToString() method that returns a string containing the general Customer information (eg: CreditCustomer 1 russell AmountDue is $4,311.00 Interest rate is 0.01). Display the dollar amounts in currency format.

Implement CompareTo to compare object customer numbers for >, <, == to implement sorting for the array of objects.

Create a CreditCustomer class that derives from Customer and implements IComparable interface.

Create a class variable named Rate using an automatic accessor.

Create an CreditCustomer class constructor that takes parameters for the Customer class fields customer number, name, amount, and rate percent that sets the Rate CreditCustomer variable to the rate percentage. Pass the id number, name and amount back to the base Customer class constructor.

Create a default, no-argument CreditCustomer class constructor that will take no parameters and will cause default values of (0, "", 0, 0) to be sent to the 4-argument CreditCustomer constructor.

Create an (override) ToString() method that returns a string containing the general Customer information (eg: CreditCustomer 1 russell AmountDue is $4,311.00 Interest rate is 0.01 Monthly payment is $179.63). Display the dollar amounts in currency format.

Implement CompareTo to compare CreditCustomer objects based on customer numbers for >, <, == to implement sorting for the array of objects.

In Main:

Create an array of five CreditCustomer objects.

Prompt the user for values for each of the five Customer object; do NOT allow duplicate Customer numbers and force the user to reenter the Customer when a duplicate Customer number is entered.

CreditCustomer objects should be sorted by Customer number before they are displayed.

When the five valid Customers have been entered, display them all, display a total amount due for all Customers, display the same information again with the monthly payment for each customer. See the input/output example shown below.

Create a static GetPaymentAmounts method that will have the current Credit customer object as a parameter and returns a double value type. Each CreditCustomer monthly payment will be 1/24 of the balance (amount due). The computed monthly individual customer payment will be returned for each CreditCustomer object in the object array.

Internal Documentation.

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Solutions
{
    public class CreditCustomer
    {
        public static void Main()
        {
            Customer CustomerOne = new Customer(100, "Sam", 10);
            Customer CustomerTwo = new Customer(1200, "Martin", 5);
            Customer CustomerThree = new Customer(1100, "Josh", 3);
            Console.WriteLine(CustomerOne.ToString());
            Console.WriteLine(CustomerTwo.ToString());
            Console.WriteLine(CustomerThree.ToString());
            CompareNumbers(CustomerOne, CustomerTwo);
            CompareNumbers(CustomerOne, CustomerThree);
            System.Console.ReadLine();
        }
        public static void CompareNumbers(Customer CustomerOne, Customer CustomerTwo)
        {
            if (CustomerOne.Equals(CustomerTwo))
                Console.WriteLine("{0} for {1} has the same Customer " +
                    "number as " + "{2} for {3}",
                    CustomerOne.CustomerNum, CustomerOne.CustomerName,
                    CustomerTwo.CustomerNum, CustomerTwo.CustomerName);
        }
        //Create a class named Customer
        public class Customer
        {
            //Create 3 Customer class fields: Customer number,
            //customer name, and amount due. Create automatic
            //accessors for each field.
            public int customerNum;
            public string customerName;
            public double amountDue;
            public int quanity;
            public const double ItemPrice = 19.95;
          
          
            public Customer(int cusNum, string CusName, int numCus)
            {
                customerNum = cusNum;
                customerName = CusName;
                Quanity = numCus;
            }

            public int CustomerNum
            {
                get
                {
                    return CustomerNum;
                }
                set
                {
                    CustomerNum = value;
                }
            }
            public string CustomerName
            {
                get
                {
                    return customerName;
                }
                set
                {
                    customerName = value;
                }
            }
            public int Quanity
            {
                get
                {
                    return quanity;
                }
                set
                {
                    quanity = value;
                    amountDue = quanity * ItemPrice;
                }
            }
            public double AmountDue
            {
                get
                {
                    return amountDue;
                }
            }
            public override string ToString()
            {
                return (GetType() + " " + CustomerNum + " " + CustomerName + " " + Quanity +
                    " @" + ItemPrice.ToString("C2") + amountDue.ToString("C2"));
            }

            public override bool Equals(Object e)
            {
                bool equal;
                Customer temp = (Customer)e;
                if (CustomerNum == temp.CustomerNum)
                    equal = true;
                else
                    equal = false;
                return equal;
            }
            public override int GetHashCode()
            {
                return CustomerNum;
            }


        }
    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote