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)
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:
Comments
Leave a comment