Question

using C#, implement classes as shown below:

nterface Order +make Order): string +make Payment (double amount): string Contact +contactID: integer name:string +address: s

Summary of Classes Class Contact Description Parent base class Constructors must set all class variables to a value, even if

Creating Objects For testing you must do the following * Create an object of each type (Customer and Vendor) . Demonstrate th

Ready to pay as 4 questions for this (not only 1), just tell me how can I pay the other 3.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Done. Please read the code and if you have any doubts leave a comment. All are done so no need to put more questions for it. Put all of them in same project and Run the code. Output screenshot is included as well.

/////////////////////////////////IOrder.cs/////////////////////////////////////////////////

using System;

namespace CustomerApp
{
    //Interface with 2 methods and will be implemeneted by the Customer and Vendor class
    public interface IOrder
    {
        string makeOrder();
        string makePayment(double amount);
    }
}

/////////////////////////////////End IOrder.cs/////////////////////////////////////////////////

/////////////////////////////////Contact.cs/////////////////////////////////////////////

/*
* Created by SharpDevelop.
* User: CKaur
* Date: 27-02-2019
* Time: 09:02
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;

namespace CustomerApp
{
    //Contact is a base class that will be used by other classes like Customer and Vendor
    public class Contact
    {
        public int contactId;
        public string name;
        public string address;
        public string phoneNum;
        
        //Constructor that sets the values according to the parameters recieved
        public Contact(int id, string n,string add,string phNumber)
        {
            contactId=id;
            name =n;
            address = add;
            phoneNum =phNumber;
        }
        //The method returns a more meaningful information about the class
        public override string ToString()
        {
            return "ID Number: " + contactId + "\n" + name +"\n" +address +"\n"+phoneNum;
        }
    }
}

//////////////////////////////////////////////End Contact.cs///////////////////////////////////////////////////////

///////////////////////////////////////////////////Customer.cs////////////////////////////////////////////////////

using System;

namespace CustomerApp
{
    //Customer class that Implemennts Order Interface and Extends Base Class Contact
    public class Customer : Contact, IOrder
    {
        //Constructor that calls the constructor of the base class i.e. Contact class
        public Customer(int id, string n,string add,string phNumber): base(id, n, add, phNumber)
        {
        
        }
        //Implement makeOrder from Interfacce Iorder
        public string makeOrder(){
            return "Incoming order from: " +base.ToString();
        }
        //Implement makePayment from Interfacce Iorder
        public string makePayment(double amount){
            return "Incoming payment of amount $"+amount +" from "+base.ToString();
        }
    }
}

////////////////////////////////////End Customer.cs//////////////////////////////////////////

////////////////////////////////////////////Vendor,cs//////////////////////////////////////////

using System;

namespace CustomerApp
{
    //Vendor class that Implemennts Order Interface and Extends Base Class Contact
    public class Vendor : Customer, IOrder
    {
        //Constructor that calls the constructor of the base class i.e. Contact class
        public Vendor(int id, string n,string add,string phNumber): base(id, n, add, phNumber)
        {
        }
        //Implement makeOrder from Interfacce Iorder
        public new string makeOrder(){
            return "Outgoing order from: " +base.ToString();
        }
        //Implement makePayment from Interfacce Iorder
        public new string makePayment(double amount){
            return "Outgoing payment of amount $"+amount +" from " +base.ToString();
        }
    }
}

//////////////////////////////////////////////End Vendor.cs//////////////////////////////////////////////////

////////////////////////////////////////////////Tester,cs////////////////////////////////////////

using System;

namespace CustomerApp
{
    //Test class creates an instancce of Customer class and Vendor class and checks the methods of both the classes
    class Tester
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Start Program !");
            //create instance of Customer class
            Customer customer1 = new Customer(100,"Jane Brown","123Main","905-555-1234");
            //create instance of Vendor class
            Vendor vendor1 = new Vendor(101,"John Black","456 Main","905-333-5678");

            //call both the methods from Customer class
            Console.WriteLine(customer1.makeOrder());
            Console.WriteLine(customer1.makePayment(55.55));
            //call both the methods from Vendor class
            Console.WriteLine(vendor1.makeOrder());
            Console.WriteLine(vendor1.makePayment(105.47));
            Console.WriteLine("Press key to Stop....");
            Console.Read();
            
        }
    }
}

/////////////////////////////////////////End Tester.cs/////////////////////////////////////////////////

Output screenshot

customerApp-SharpDevelop File Edit View Project Build Debug Search Analysis Tools Window Help Vendor.cs Contact. Order.cs Cus

Add a comment
Know the answer?
Add Answer to:
using C#, implement classes as shown below: Ready to pay as 4 questions for this (not...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write in C++ please: Write a class named MyVector using the following UML diagram and class...

    Write in C++ please: Write a class named MyVector using the following UML diagram and class attribute descriptions. MyVector will use a linked listed instead of an array. Each Contact is a struct that will store a name and a phone number. Demonstrate your class in a program for storing Contacts. The program should present the user with a menu for adding, removing, and retrieving Contact info. MyVector Contact name: string phone: string next: Contact -head: Contact -tail: Contact -list_size:...

  • HELLO, PLEASE TAKE TIME TO ANSWER THIS QUESTION. PLESE ENSURE ITS CORRECT AND SHOW THAT THE...

    HELLO, PLEASE TAKE TIME TO ANSWER THIS QUESTION. PLESE ENSURE ITS CORRECT AND SHOW THAT THE PROGRAM RUNS. Task 1: Enforcing const-ness throughout Your first job will be to go through all of the code and decide which functions should be declared const. You should find several places throughout the program where this makes sense. We will also make the id data member in the Customer class const , as once a customer has been created their ID will never...

  • The ", delimiter" should now be changed to use the "^ delimiter". There needs to be...

    The ", delimiter" should now be changed to use the "^ delimiter". There needs to be an 2nd address field added to the original code, as well as, a "plus 4" on the zip code (example: 47408-6606). Then the additional prompts must be added. Thank you! Last Real-World problem (in module 04 - 05), you added functionality to allow the user to enter multiple patients until the user indicated done. You are to enhance this functionality. Add the following functionality...

  • In below C++ sort.cpp 1- Implement the insertion_sort function. 2- Implement the compareSensorPtr function and the...

    In below C++ sort.cpp 1- Implement the insertion_sort function. 2- Implement the compareSensorPtr function and the code in main to create and sort the array of pointers. The places to make modifications are indicated by TODO: comments. You should not have to make modifications anywhere else. 3- what's big O and runtime for 100000 items. #include <iostream> #include <algorithm> #include <numeric> #include <vector> #include <string> #include <cstdlib> #include <cassert> using namespace std; // Set this to false to skip the...

  • I need to complete the C++ program for hotel reservation. In the main cpp you have...

    I need to complete the C++ program for hotel reservation. In the main cpp you have to display the hotel information from the hotel.txt based on customer preferences(which can be taken from the User.txt) For example, if the customer's budget is 200$, then only the hotels with prices below that amount should be displayed. Then the user has an option to choose which one to reserve for the particular time(which also can be found in the user.txt) The last two...

  • Problem Statement: A company intends to offer various versions of roulette game and it wants you...

    Problem Statement: A company intends to offer various versions of roulette game and it wants you to develop a customized object-oriented software solution. This company plans to offer one version 100A now (similar to the simple version in project 2 so refer to it for basic requirements, but it allows multiple players and multiple games) and it is planning to add several more versions in the future. Each game has a minimum and maximum bet and it shall be able...

  • Super stuck on a couple of questions on this scenario. Advanced Scenario 7: Mark and Barbara...

    Super stuck on a couple of questions on this scenario. Advanced Scenario 7: Mark and Barbara Matthews Directions Using the tax software, complete the tax retum, including Form 1040 and all appropri- ate forms, schedules, or worksheets. Answer the questions following the scenario. Note: When entering Social Security numbers (SSNS) or Employer identification Numbers (EINS), replace the Xs as directed, or with any four digits of your choice. Interview Notes • Mark and Barbara are married and want to file...

  • Oracle only database: DROP TABLE ORDERITEMS; DROP TABLE Orders; DROP TABLE BOOKAUTHOR; DRO...

    oracle only database: DROP TABLE ORDERITEMS; DROP TABLE Orders; DROP TABLE BOOKAUTHOR; DROP TABLE BOOKS; DROP TABLE PROMOTION; DROP TABLE AUTHOR; DROP TABLE CUSTOMERS; DROP TABLE PUBLISHER; CREATE TABLE Customers ( Customer# NUMBER(4), LastName VARCHAR2(10) NOT NULL, FirstName VARCHAR2(10) NOT NULL, Email VARCHAR(40), Address VARCHAR2(20), City VARCHAR2(12), State VARCHAR2(2), Zip VARCHAR2(5), Referred NUMBER(4), Region CHAR(2), CONSTRAINT customers_customer#_pk PRIMARY KEY(customer#) ); INSERT INTO CUSTOMERS VALUES (1001, 'MORALES', 'BONITA', '[email protected]', 'P.O. BOX 651', 'EASTPOINT', 'FL', '32328', NULL, 'SE'); INSERT INTO CUSTOMERS VALUES...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT