class Program
{
static void Main([] args)
{
letterOfDrive;
int driveSpeedInRPM;
int amountOfMemory;
input;
Drive[] drives = null;
for (int i = 0; i < 3; i++)
{
Console.WriteLine("Please enter the letter of the drive, and press ENTER");
input = Console.ReadLine();
letterOfDrive = input[0];
Console.WriteLine("Please enter the speed of drive in RPM, and press ENTER");
input = Console.ReadLine();
driveSpeedInRPM = int.Parse(input);
Console.WriteLine("Please enter the amount of memory of drive in K, and press ENTER");
input = Console.ReadLine();
amountOfMemory = int.Parse(input);
drives[i] = new Drive(driveSpeedInRPM, amountOfMemory, letterOfDrive);
}
int size;
int resolutionX;
int resolutionY;
Monitor[] monitors = null;
for (int i = 0; i < 2; i++)
{
Console.WriteLine("Please enter the size of the monitor in inch, and press ENTER");
input = Console.ReadLine();
size = int.Parse(input);
Console.WriteLine("Please enter the resolution X of monitor, and press ENTER");
input = Console.ReadLine();
resolutionX = int.Parse(input);
Console.WriteLine("Please enter the resolution Y of monitor, and press ENTER");
input = Console.ReadLine();
resolutionY = int.Parse(input);
monitors[i] = new Monitor(size, resolutionX, resolutionY);
}
manufacturerName;
modelName;
int anountMemoryInRAM;
Console.WriteLine("Please enter the name of manufacturer of the computer, and press ENTER");
manufacturerName = Console.ReadLine();
Console.WriteLine("Please enter the model of the computer, and press ENTER");
modelName = Console.ReadLine();
Console.WriteLine("Please enter the amount of memory in RAM of the computer, and press ENTER");
input = Console.ReadLine();
anountMemoryInRAM = int.Parse(input);
//Computer computer;
//computer = new Computer();
}
}
class Drive
{
public int driveSpeedInRPM;
public int amountOfMemory;
public letterOfDrive;
public Drive(int driveSpeedInRPM, int amountOfMemory, letterOfDrive)
{
this.driveSpeedInRPM = driveSpeedInRPM;
this.amountOfMemory = amountOfMemory;
this.letterOfDrive = letterOfDrive;
}
public void print()
{
Console.WriteLine("the drive: {0}, has {1} drive speed in RPM, and {2} amount of memory", this.letterOfDrive, this.driveSpeedInRPM, this.amountOfMemory);
}
}
class Monitor
{
public int size;
public int resolutionX;
public int resolutionY;
public Monitor(int size, int resolutionX, int resolutionY)
{
this.size = size;
this.resolutionX = resolutionX;
this.resolutionY = resolutionY;
}
public void print()
{
Console.WriteLine("the monitor has {0} inches, and the resolution is: {1} on {2}", this.size, this.resolutionX, this.resolutionY);
}
}
class Computer
{
manufacturerName;
modelName;
int anountMemoryInRAM;
Drive[] drives;
Monitor[] monitors;
public Computer( manufacturerName, modelName, int anountMemoryInRAM, Drive drive, Monitor monitor)
{
this.manufacturerName = manufacturerName;
this.modelName = modelName;
drives = new Drive[5];
monitors = new Monitor[4];
connectDrives(drive);
connectMonitors(monitor);
}
public void connectDrives(Drive drive)
{
bool flag = true;
for (int i = 0; i < 5 && flag; i++)
if (drives[i] == null)
{
drives[i] = drive;
flag = false;
}
}
public void connectMonitors(Monitor monitor)
{
bool flag = true;
for (int i = 0; i < 4 && flag; i++)
if (monitors[i] == null)
{
monitors[i] = monitor;
flag = false;
}
}
public void print(Drive[] drives, Monitor[] monitors)
{
int count = 0;
for (int i = 0; i < 5; i++)
{
if (drives[i] != null)
count++;
}
Console.WriteLine("the computer made by {0}, the model is: {1}, his memory is: {2} RAM. conected to him {3} drives:", this.manufacturerName, this.modelName, this.anountMemoryInRAM, count);
for (int i = 0; i < 5; i++)
if (drives[i] != null)
Console.WriteLine("{0}. {1}, has {2} drive speed in RPM, and {3} amount of memory.", i, drives[i].letterOfDrive, drives[i].driveSpeedInRPM, drives[i].amountOfMemory);
count = 0;
for (int i = 0; i < 4; i++)
{
if (monitors[i] != null)
count++;
}
Console.WriteLine("and conected to him {0} monitors:", count);
for (int i = 0; i < 4; i++)
if (monitors[i] != null)
Console.WriteLine("{0}, he has {1} inches, and the resolution is: {2} on {3}", i, monitors[i].size, monitors[i].resolutionX, monitors[i].resolutionY);
}
}