Computes the area of a rectangle

Assignment Help C/C++ Programming
Reference no: EM13184113

Question 1:

Create 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.

1439_Computes the area of a rectangle.png

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:

1884_Computes the area of a rectangle1.png

Question 2:

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, andinitializes 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

1539_Computes the area of a rectangle2.png

Reference no: EM13184113

Questions Cloud

Explain specific metric unit : When working NMR questions, solutions maunuals say that the peaks are 1.0 spaces long or 5.5 spaces long.
Calculate the intercept in each of the four quarters : Consider a firm subject to quarter-to-quarter variation in its sales. Suppose that the following equation was estimated using quarterly data for the period 2006-2013 (the time variable goes from 1 to 32). The variables D1, D2 and D3 are , respecti..
Explain the dimensions of a typical atom : How would this computed ? compare with the dimensions of a typical atom? (-1 if much smaller, 0 if about the same magnitude, +1 if much bigger)
How the government is increasing the minimum wage : Assume you are the owner of a small cafe that employs 15 people, 10 of whom are front-line, unskilled workers, and currently paid the minimum wage. The state government is considering increasing the minimum wage. As a business owner, would you su..
Computes the area of a rectangle : Create an object oriented application with C# that computes the area of a rectangle, and the area and the volume of a cuboid.
Leadership and organizing-sensemaking in action : In this week's 'Leadership and organizing: sensemaking in action' article by Pye, the chief executive (CE) in the case took an approach to change that resulted in his being terminated. Was he too focussed on his preeminent 'position' as a formal lead..
How much heat in joules is required to raise the temperature : How much heat in Joules is required to raise the temperature of 1.000 kg of water by 60.0 oC? Cp,m (H2O) = 75.29 J mol-1 K-1. Molar Mass (H2O) = 18.015 g mol-1.
What will happen to exports and imports : Let's assume that thereare no trade barriers and exchange rates are freely fluctuating. At the same time, the European Union develops a technology that reduces the cost of production for most of their exporting products. Explain what will happen ..
Crowded mall parking lot : In a crowded mall parking lot, dozens of people hear a female voice yell, "He's killing me!" Yet no one calls the police. What is the reason for the lack of action, according to Darley and Latané?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c function to convert gallons-quarts-pints and cups

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups.

  To reverse the order of elements on a stack

Write a program in C++ to  reverse the order of elements on a stack S using two additional stacks using one additional stack

  An expression whose value depends upon the evaluation

Give an example in C++ of an expression whose value depends upon the evaluation order. Show the orders that produce different values and the values they produce. Explain what side effect is the expression contains.

  Write a program that declares three one dimensional

Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

  Create a text adventure game that uses pointers

Create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased.

  Design a deck plan space ship in eclipse

Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls.

  Create a 1-dimensional (1d) array

Write a program to create a 1-dimensional (1D) array that contains 15 characters and display to the screen a count of the occurrences of each of the vowels a, e, i, o, and u in the array.

  The two-dimensional array

1. Given the two-dimensional array declared by the following statement int myArray[4][3] = {{2,4,6},{1,8,10},{3,5,7},[9,11,13}}; what is the value of myArray[1][2]

  Program that read in from the key board a string

Write a complete C++ program that read in from the key board a string and convert all letters in the string to upper cases. You are not allowed to use toupper function.

  In competitive tournament

In competitive tournaments, it is common for all the players or teams to play in a series of matches in order to determine a single winner of the entire tournament. However, a number of different tournament formats exist. Here, we will concern our..

  Write a program in c of fibonacci series

Write a program in c of fibonaci series with and without using fibo func, both

  Create class having constructor to recieve two ints

Create a class (in C++)named Card. The class should have two int data members named face and suit.The class should have a constructor that recieves the two ints and uses them to initialize the data members.

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