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
//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();
}
}
}
Comments
Leave a comment