Review structured programming concepts - describe the


Object Oriented Programming - Inheritance and access rights - Method Overriding Contributing to the following CLOs:

CLO #1 Review structured programming concepts.

CLO #2 Describe the main concepts of the object-oriented programming paradigm.

CLO #3 Write and Compile programs that incorporate Object Oriented software constructs such as classes, objects, methods.

CLO #4 Apply object oriented concepts such as encapsulation, inheritance, polymorphism, and operator overloading.

1. Use Microsoft Visual C# 2010 to create the program.

2. The programs source code must be pasted into word document.

3. This work should be submitted into moodle website (https://ect.ac.ae/elearn).

Question 1:

Write a C# program that implements the following: 1. Create a Base class named property. ? This class is characterized by the following auto implemented properties: - A propNbr attribute that has a string type - A NbrBedRooms attribute that has an int type - A year attribute that has an int type ? The class property includes also the following methods : - DisplayData () that displays all data about an object property. - A method, called CalculatePrice(), that calculates and returns the property price according to this formula : price = 2000+ NbrBedRooms *1000 .

2. Create a class named Home which is derived from the base class property - This class is is characterized by the following auto implemented properties: - A bool attribute named garden - A bool attribute named garage - The class Home includes also the following methods - DisplayData () that displays all data about an object Home. - A method, called CalculatePrice(), that calculates and returns the property price according to this procedure :

i. Originaly price = 2000 + NbrBedRooms *1000 .

ii. If garage is true, 1000 is added to the price

iii. If garden is true, 2000 is added to the price 3.

In the main method of your program, implement the following: - Create an object called P which is an instantiation of the base class property.

The values of its different attributes are as follows: propNbr= p123, NbrBedRooms = 2, year = 2010 - Create an object called H which is an instantiation of the base class Home.

The values of its different attributes are as follows: propNbr= p130, NbrBedRooms = 3, year = 2012, garage = true, garden= false. - Display the characteristics P. - Calculate and display the price of P. - Display the characteristic of H. - Calculate and display the price of H. The program result looks like the following:

Question 2: Create an object oriented application with C# that allows the user to enter two colors, and then to mix them. The application then should print the resulting color and its details. To construct the application you need to:

1. define a class called Colors characterized by the following attribute and methods: . One private attribute:

o A string Name. . A constructor (with one parameter) to assign a value to the name when creating the object (an instance of a class).

An overloaded operator + to mix two Color objects o For the resulting attribute name use the following table. Color1 Color 2 blue red yellow blue blue purple green red purple red orange yellow green orange yellow.

A method to print the name of an object of the class color.

2. Write am main method that implements the following: . Create two Color objects C1 and C2.

Your program should ask the user to enter name attribute for each object. . Mix C1 and C2 . Display the the resulting color. . The output of the application should look like the following.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Review structured programming concepts - describe the
Reference No:- TGS0976502

Expected delivery within 24 Hours