Object Oriented Programming, C/C++ Programming

Assignment Help:
Ask queCreate an object oriented application with C# that computes the area of a rectangle, and the area and the volume of a cuboid.

Based on the inheritance concept, create a base class called Rectangle (The parent class) and a derived class called Cuboid (The child class) as shown in Figure 1.



Figure 1

The formulas that you require for your calculation are as follows:

o Area of a rectangle: (length * width)
o Area of a cuboid: (4 * length * width) + (2 * length* length)
o Volume of a cuboid: (length * width * length)


The output of the application will look like the following:











Question 2: (5 marks)

The Question: Write a C# program that implements the following:

Let us define here an abstract super-class named Employee, a first derived class named RegularEmployee and a second derived class named SalesEmployee. The SalesEmployee class includes an extra property, salesbonus, and overrides the method CalculatePay() in order to take it into account.
1. The base abstract class Employee contains:
• A string attribute name and a protected decimal attribute basepay. Indeed, Basepay is defined as protected, so that it may be accessed only by this class and derrived classes.
• A constructor to set the name and basepay values.
• An abstract method CalculatePay() returning the basepay and can be overridden.

2. The first derived class RegularEmployee from Employee contains:
• The constructor calls the base-class version.
• Override the CalculatePay() method.
3. The second derive class SalesEmployee from Employee containing:
• New field salesbonus that will affect the base pay.
• The constructor calls the base-class version, and initializes the salesbonus field.
• Override the CalculatePay() method to take bonus into account.
4. The main method of your program, implement the following:
• Print the following message: *** Welcome to Employee program ***
• Create an object called employee1 from class RegularEmployee. Pass name and basepay here as Abdulla and 1200 respectively.
• Create an object called employee2 from class SalesEmployee. Pass name, basepay and salesbonus here as Mohamed, 1000 and 500 respectively.
Display the following messages: The first employee Abdulla earned: 1200
The second employee Mohamed earned: 1500

The final output of your program should look like the screen shot below

stion #Minimum 100 words accepted#

Related Discussions:- Object Oriented Programming

Oop, write a program which has three classes

write a program which has three classes

Write an application to test class integerset, Set of Integers) Create clas...

Set of Integers) Create class IntegerSet. Each IntegerSet object can hold integers in the range 0-100. The set is represented by an array of bools. Array element a[i] is true if in

Type compatibility, Define  T y pe c o m p a t i b i li t y? ...

Define  T y pe c o m p a t i b i li t y? T o a s s i g n i n t t o s m a l l i n t t h e v a r i a b l e should b e

Program, write a program that adds all numbers from 1 to 200

write a program that adds all numbers from 1 to 200

Decode the code, smugglers transfer the messages from one to another by usi...

smugglers transfer the messages from one to another by using the mobile

Write a program for simulating jet-powered car acceleration, The absolute l...

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th

Explain public and private members, Public, Private and Protected members: ...

Public, Private and Protected members: Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP i

I need keylogger extension on chrome, Project Description: I want someon...

Project Description: I want someone to create and install a keylogger on a chrome browser. This could be a relatively simple job, please have experience with this type of work.

Program to calculate pie, This problem familiarizes you with using random n...

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of p using a simulation method called "Monte Carlo". The following fi

Program to list the cities and their states, The program will ask the user ...

The program will ask the user to enter: '1' to List the cities(and their state abbrev)  from largest to smallest (by their population) with their population '2'  to List the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd