Answer to Question #188613 in C# for CHANDRASENA REDDY

Question #188613

Create Supplier instance in SupplierTest class, invoke AcceptDetails method to accept the details of the supplier from the user and invoke DisplayDetails method to display the given details of the supplier.


Supplier:

Supplierid: int

SupplierName: String Supplier Test

City: String ---------------> ________________

PhoneNum: String +Main(String[] args)

Email: String

____________________

+Accept Details(Supplier): Void

+Display Details: Supplier


1
Expert's answer
2021-05-05T11:28:13-0400
//SupplierTest.cs

using System;

namespace MyApplication
{
    class SupplierTest
    {
        int Supplierid;
        string SupplierName;
        string City;
        string PhoneNum;
        string Email;

        public void AcceptDetails()
        {
            Console.WriteLine("Enter Supplier's ID:");
            this.Supplierid = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter Supplier's name:");
            this.SupplierName = Console.ReadLine();

            Console.WriteLine("Enter Supplier's city:");
            this.City = Console.ReadLine();

            Console.WriteLine("Enter Supplier's phone number:");
            this.PhoneNum = Console.ReadLine();

            Console.WriteLine("Enter Supplier's email:");
            this.Email = Console.ReadLine();
        }

        public void DisplayDetails()
        {
            Console.WriteLine("\nInformation about Supplier");
            Console.WriteLine("ID: " + this.Supplierid);
            Console.WriteLine("Name: " + this.SupplierName);
            Console.WriteLine("City: " + this.City);
            Console.WriteLine("Phone number: " + this.PhoneNum);
            Console.WriteLine("Email: " + this.Email);

        }

    }
}

// Program.cs

using System;

namespace MyApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            SupplierTest supplier = new SupplierTest();

            supplier.AcceptDetails();

            supplier.DisplayDetails();
        }
    }
}

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