Write a public get method to retrieve the value of sidecar

Assignment Help Basic Computer Science
Reference no: EM131397401

USING INHERITANCE TO CREATE A DERIVED CLASS IN C++ In this lab, you create a derived class from a base class and then use the derived class in a C++ program. The program should create two Motorcycle objects and then set the Motorcycle's speed, accelerate the Motorcycle object, and check its side car status. Use the Vehicle and Automobile classes that you worked with earlier in this chapter as a guide.

1. Open the file named Motorcycle.cpp using Notepad or the text editor of your choice.

2. Create the Motorcycle class by deriving it from the Vehicle class. Use a public derivation.

3. In the Motorcycle class, create a private attribute named sidecar. The sidecar attribute should be data type bool.

4. Write a public set method to set the value for sidecar.

5. Write a public get method to retrieve the value of sidecar.

6. Write a public accelerate method. This method overrides the accelerate method inherited from the Vehicle class. Change the message in the accelerate method so the following is displayed when the Motorcycle tries to accelerate beyond its maximum speed: "This Motorcycle cannot go that fast".

7. Save this class file, Motorcycle.cpp, in a directory of your choice and then open the file named MyMotorcycleClassProgram.cpp.

8. In the MyMotorcycleClassProgram, create two Motorcycle objects named motorCycleOne and motorCycleTwo.

9. Set the sidecar value of motorcycleOne to true and the sidecar value of motorcycleTwo to false.

10. Set motorcycleOne's maximum speed to 90 and motorcycleTwo's maximum speed to 85.

11. Set motorcycleOne's current speed to 65 and motorcycleTwo's current speed to 60.

12. Accelerate motorcycleOne by 30 miles per hour (mph) and accelerate motorcycleTwo by 20 mph.

13. Print the current speed of motorcycleOne and motorcycleTwo.

14. Determine if motorcycleOne and motorcycleTwo have side cars. If yes, display the following: "This motorcycle has a side car". If not, display the following: "This motorcycle does not have a side car".

15. Save MyMotorcycleClassProgram.cpp in the same directory as Motorcycle.cpp.

16. Compile the source code file MyMotorCycleClassProgram.cpp.

17. Execute the program.

18. Record the output below.

Reference no: EM131397401

Questions Cloud

Sign test and the wilcoxon signed rank test : Verify that according to the sign test, ˆp = 0.29 and that the 0.95 confidence interval for p is (0.04, 0.71), and that the Wilcoxon signed rank test has an approximate p-value of 0.08.
Assemble a computer component : The times (in minutes) to assemble a computer component for 3 different machines are listed in the table below. Workers are randomly selected.
What does given indicate in terms of power : Is it possible that the marginal trimmed means are equal but the trimmed mean based on the difference scores is not equal to zero? What does this indicate in terms of power?
Write an analysis of a peer-reviewed article published : IHP 340- Write an analysis of a peer-reviewed article published within the last three years that is related in some way to the health professional programs at SNHU.
Write a public get method to retrieve the value of sidecar : Write a public accelerate method. This method overrides the accelerate method inherited from the Vehicle class. Change the message in the accelerate method so the following is displayed when the Motorcycle tries to accelerate beyond its maximum sp..
What is the maximum value : Consider the function f(x) = x2 for 0 ≤ x ≤ 10. Prove that limx→5 f(x) = 25. Note that proofs of limits involve the epsilon / delta (or ε / δ) method. Hint: What is the maximum value of x + 5 on the interval [0, 10]?
Perform the paired t test for means : For the data in Table, perform the paired T test for means using the weights for the east and south sides of the trees. Verify that the p-value is 0.09.
Future human resources needs of an organization : When an HR Department is planning for the future Human Resources needs of an organization, it is also involved in an Internal Assessment of its current workforce. What is the purpose of this activity – Describe briefly
Managing human resources : The aim of this assignment is to assess understanding of the theory and practice of human resource management focussing on current human resources practice and the impact of topical issues and legislation.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Have the image you want to copy visible on your computer

* Have the image you want to copy visible on your computer screen. * Simultaneously, hold down the Control (Ctrl), Alternate (Alt) and Print Screen (PrntScrn) keys on your keyboard. * Go to an open Word Document * Paste the image (either right cli..

  Principal components of telecommunications networks

What are the principal components of telecommunications networks and key networking technologies? Let's begin by describing the features of a simple network.

  What is the drawback of using end-to-end security

What is the drawback of using end-to-end security? Provide examples and arguments to support your viewpoint.

  File name according to the section of the assignment

File name according to the section of the assignment

  interlocking words on a Scrabble board

The board game Scrabble works by assigning points to wooden tiles that are marked with printed letters, and are arranged as interlocking words on a Scrabble board.

  Create one z-specification for system

Create one (1) short Z-specification for this system using Visio or an equivalent such as Dia. Note: The graphically depicted solution is not included in the required page length.

  Substantial taxpayer assistance but the original shareholder

In 2000, one share of General Motors stock was worth about $80. In 2008, it was worth about $18. Then GM declared bankruptcy and each share is essentially worthless (they have since re-formed with substantial taxpayer assistance but the original..

  Any rfcs that discuss sip trunking

Write a 500-word paper that explains what a SIP trunk is, why you would use a SIP trunk, the equipment required for its use, and any RFCs that discuss SIP trunking.

  Which is an ssl server

Suppose that Bob is a client that connects to Alice, which is an SSL server. Assume Bob creates a message = EB (rec, H(rec, MB)) and sends it to Alice. How does Alice process the arrived message?

  Company marketing departments

A company's corporate IT department has a hosting platform specifically for systems used by the company's marketing departments at it's different divisions. However, the corporate IT department needed to bill the different divisions for their exac..

  Describe how to develop users for sales organization unit

Describe how you would develop users for sales organization unit and how you can set up work groups in this particular situation.

  Computerized analysis of yahoo annual reports

Computerized Analysis of Yahoo's Annual Reports and Financial Statements Section 1: Accounting for decision making Name five stakeholders that are relevant to Yahoo

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