Answer to Question #189007 in C# for CHANDRASENA REDDY

Question #189007

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:

City: String

PhoneNum: String

Email: String

____________________

+Accept Details(Supplier): Void

+Display Details: Supplier



String Supplier Test

_________________

+Main(String[] args)


1
Expert's answer
2021-05-11T00:22:26-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace C_SHARP
{
    class Supplier
    {
        private int Supplierid;
        private string SupplierName;
        private string City;
        private string PhoneNum;
        private string Email;


        public void AcceptDetails()
        {
            Console.Write("Enter Supplier ID: ");
            Supplierid = int.Parse(Console.ReadLine());
            Console.Write("Enter Supplier name: ");
            SupplierName = Console.ReadLine();
            Console.Write("Enter Supplier city: ");
            City = Console.ReadLine();
            Console.Write("Enter Supplier phone number: ");
            PhoneNum = Console.ReadLine();
            Console.Write("Enter Supplier email: ");
            Email = Console.ReadLine();
        }


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


        }
    }
    class SupplierTest
    {
        static void Main(string[] args){
            Supplier newSupplier = new Supplier();
            newSupplier.AcceptDetails();
            newSupplier.DisplayDetails();
            Console.ReadKey();


        }
    }
}



Example:



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