You are on page 1of 3

OOP ASSES 1

progrram.cs

using System;
class Program {
public static void Main(string[] args) {
Console.WriteLine("Enter the length of the rectangle");
int length = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the width of the rectangle");
int width = Convert.ToInt32(Console.ReadLine());
Rectangle rectangle = new Rectangle(length, width);
rectangle.Display();

Console.WriteLine("Enter the new dimension");


int d = Convert.ToInt32(Console.ReadLine());
Rectangle rectangle2 = rectangle.DimensionChange(d);
rectangle2.Display();

}
}

Rectangle.cs

using System;
public class Rectangle{
private int _length;
private int _width;

//Fill your code here


public Rectangle(int l, int w){
_length = l;
_width = w;
}

public int Area() {


//Fill your code here
return _length*_width;
}

public void Display() {


Console.WriteLine("Rectangle Dimension");
//Fill your code here
Console.WriteLine("Length:" + _length);
Console.WriteLine("Width:" + _width);
Console.WriteLine("Area of the Rectangle:" + _length*_width);

public Rectangle DimensionChange(int d) {


//Fill your code here
Rectangle obj = new Rectangle( _length*d, _width*d);
return obj;
}
}

OOP ASSES 2
program.cs

using System;

public class Program {


public static void Main(string[] args)
{
Customer customer = new Customer();

Console.WriteLine("Enter the Customer Details");


Console.WriteLine("Enter the name");
customer.CustomerName = Console.ReadLine();
Console.WriteLine("Enter the email");
customer.CustomerEmail = Console.ReadLine();
Console.WriteLine("Enter the type");
customer.CustomerType = Console.ReadLine();
Console.WriteLine("Enter the location");
Console.WriteLine("");
customer.CustomerAddress = Console.ReadLine();
customer.DisplayDetails();

}
}

customer.cs

using System;

class Customer {
private string _customerName;
private string _customerEmail;
private string _customerType;
private string _customerAddress;

public string CustomerName {


get{ return this._customerName; }
set{ this._customerName = value; }
}
public string CustomerEmail {
get{ return this._customerEmail; }
set{ this._customerEmail = value; }
}
public string CustomerType {
get{ return this._customerType; }
set{ this._customerType = value; }
}
public string CustomerAddress {
get{ return this._customerAddress; }
set{ this._customerAddress = value; }
}

public void DisplayDetails() {


Console.WriteLine("Customer Details");
Console.WriteLine("Name: " + _customerName);
Console.WriteLine("E-mail: " + _customerEmail);
Console.WriteLine("Type: " + _customerType);
Console.WriteLine("Location: " + _customerAddress);
}
}

OOP assess 3

You might also like