Question 1 create an object oriented application with c

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

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: EM13379768

Questions Cloud

Toadycom is a new public phone and internet company heavily : toady.com is a new public phone and internet company heavily financed by the eastpac bank. during your audit of
Questionabc ltd recently established an audit committee in : questionabc ltd recently established an audit committee in compliance with the australian stock exchange listing
Researcher adams wants to conduct a work sampling study and : researcher adams wants to conduct a work sampling study and decides to research how much time is spent at the water
Impact of accounting for operating leases as capital : impact of accounting for operating leases as capital leasesvirtually all firms have some amount of commitment under
Question 1 create an object oriented application with c : question 1 create an object oriented application with c that computes the area of a rectangle and the area and the
1 wal-mart has had several stock splits its stock price is : 1. wal-mart has had several stock splits. its stock price is hovering around 50 per share. berkshire hathaway led by
Nfec use the last two fiscal years financial statements of : nfec use the last two fiscal years financial statements of the publicly-traded company you selected and calculate the
Cfidence interval estimate for the meandata nbspsample : confidence interval estimate for the meandata nbspsample standard deviationnbsp1.9667sample meannbsp 20.73sample
Explain what is meant by obedience and how it differs from : explain what is meant by obedience and how it differs from conformity.outline and evaluate research on obedience in

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write the entire definition for the main function

Write the entire definition for the main function that prints out all of the command-line arguments on its own line.

  Write a program that asks the user to enter the monthly cost

Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost ..

  Prompt the user for and read 6 numbers

Write a program using an array that will store input data. Prompt the user for and read 6 numbers between 70 and 90. Verify the numbers should be greater than 70 and less than 90. If the number is less than or equal to 70 or greater than 90, repro..

  Write a program that finds the equivalent series

Write a program that finds the equivalent series and parallel resistance for a collection of resistor values. Your program should scan first the number of resistors and then the resistor values. Then compute the equivalent series resistance for all r..

  Questionnbspnbspi have a product called neverwet that

questionnbspnbspi have a product called neverwet that creates a hydrophobic surface on stuff. theres a base and top

  A string of characters has balanced parentheses

A string of characters has balanced parentheses if each right parenthesis occurring in a string is matched with a preceding left parenthesis

  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.

  You will create a linked list module

You will create a linked list module that exactly meets the specifications given in the supplied header (.h) file. The playlist program must accept a filename on the command line (argv).

  Implement a semantic analysis

The program will implement Semantic Analysis. The assignment provides two options to define variable scope, either using the Global Option or the Local Option.

  Write equivalent compound statements

What action must be taken before a variable can be used in a program?

  The reverse of each word, and a palindrome checker

give us the first letter of each word, the first half of each word, the reverse of each word, and a palindrome checker to see if the word is a palindrome.

  We base our need to implement composition upon

What criterion, or criteria, should be used to include objects of a class as data members of another class? In other words, what should we base our need to implement composition upon?

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