Computer Class Code
Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class computer
{
string made;
string model;
string colour;
int ClockSpeed;
int StorageGB;
int memoryGB;
public void GetData()
{
Console.WriteLine("ENter
made");
made = Console.ReadLine();
Console.WriteLine("Enter
model");
model = Console.ReadLine();
Console.WriteLine("Enter
colour");
colour = Console.ReadLine();
Console.WriteLine("Enter
clock speed");
ClockSpeed =Convert.ToInt32( Console.ReadLine());
Console.WriteLine("Enter
Storage capacity in Gb");
StorageGB =Convert.ToInt32( Console.ReadLine());
Console.WriteLine("Enter
memory in Gb");
memoryGB = Convert.ToInt32(Console.ReadLine());
}
public void Display()
{
Console.WriteLine("Made is {0}", made);
Console.WriteLine("Model
is {0}", model);
Console.WriteLine("Colour
is {0}", colour);
Console.WriteLine("Clock
speed is{0}",ClockSpeed);
Console.WriteLine("Storage
in Gb= {0}", StorageGB);
Console.WriteLine("Memory
Storage is {0}", memoryGB);
}
}
class Program
{
static void Main(string[] args)
{
computer c1 = new computer();
c1.GetData();
c1.Display();
}
}
}
No comments:
Post a Comment