Question No 2: Design a class named Vehicle that includes A data member named VID...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question No 2: Design a class named Vehicle that includes • A data member named VID • A parameterized constructor to initialize VID • A getter function to get the value of VID Derive a class named car inherited from Vehicle class and contains • Two additional data members i.e. color and model • A parameterized constructor to initialize its own data fields along with the inherited data field Two getter functions that return the color and model, respectively Derive a class named Motorbike inherited from class Vehicle and has • A data field named engine_cc • A data field named distance_traveled A data field named fuel_per_km Total Number: 10 . A function named total_fuel_used that returns total fuel used. A member function named display to show total_fuel_used, • A member function to write all the information in a text file. The name of file is your name. Create main and test the above classes. Question No 2: Design a class named Vehicle that includes • A data member named VID • A parameterized constructor to initialize VID • A getter function to get the value of VID Derive a class named car inherited from Vehicle class and contains • Two additional data members i.e. color and model • A parameterized constructor to initialize its own data fields along with the inherited data field Two getter functions that return the color and model, respectively Derive a class named Motorbike inherited from class Vehicle and has • A data field named engine_cc • A data field named distance_traveled A data field named fuel_per_km Total Number: 10 . A function named total_fuel_used that returns total fuel used. A member function named display to show total_fuel_used, • A member function to write all the information in a text file. The name of file is your name. Create main and test the above classes.
Expert Answer:
Answer rating: 100% (QA)
SOURCE CODE include include using namespace std vehicle class class Vehicle public member function v... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Consider six classes i.e. Person, Professor, Researcher, Department, Laboratory, and University having following specifications. Class University has Two attributes of type string i.e....
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Saeed made the following purchases of ordinary shares in Hyban plc: In June 2017, the company made a 1 for 20 rights issue at 1.50 per share and Saeed took up the shares which he was offered....
-
Wilmington Composites, Inc., developed its overhead application rate from the annual budget. The budget is based on an expected total output of 720,000 units requiring 3,600,000 machine hours. The...
-
Which of the following statements about inventory turnover is false? (a) Inventory turnover measures the efficiency of the firm in managing and selling inventory. (b) Inventory turnover is a gauge of...
-
What is a "comprehensive basis of accounting other than GAAP"?
-
Brandt Boot Co. sells men's, women's, and children's boots. For each type of boot sold, it operates a separate department that has its own manager. The manager of the men's department has a sales...
-
Julia can swim 0.62 m/s in still water. She swims directly east across a river that is 120 m wide and lands at a point that is 74 m north downstream. Determine Julia's velocity while swimming...
-
Evaluate the function \(f(x, y)=\frac{2}{3} e^{-x / 2} \cos (y-1)\) for \(x=-0.23, y=2.7\) by: a. Using the subs command. b. Conversion into a MATLAB function.
-
1. It is a tertiary amine: a) ethylamine b) trimethylamine c) triethylammonium chloride d) diphenylamine 2- The 5-hydroxypentanoic acid compound has a hydroxyl group on one carbon: a) Delta b) Beta...
-
Express the distance of the Dubai World Cup horserace in kilometers to the same number of significant digits needed to answer problem 42. Data from Problem 42 The Dubai World Cup horserace is 2000...
-
You measure a quantity \(T\) that can be represented as \(=2 \pi \sqrt{\frac{l}{g}}\). If \(T\) and \(l\) have the units of seconds and meters, respectively, then what should the units of \(g\) be...
-
The Dubai World Cup horserace is 2000 meters long. Express this distance in miles.
-
You have \(2.28 \mathrm{~kg}\) of rice and wish to divide it evenly among five people. If you calculate how much rice each person receives, how many significant digits does your answer have?
-
An ant walks along a tight thread that is oriented north to south and can be taken to coincide with the \(y\) axis. The ant walks \(7 \mathrm{~cm}\) south, then turns and walks \(2 \mathrm{~cm}\)...
-
A user reports that they cannot access any network resources. The result of running the ipconfig command shows an IP address that starts with 169.254.x.x. What could be causing the problem? SSH...
-
Fahrad Inc. sells all of its product on account. Fahrad has the following accounts receivable payment experience: Percent paid in the month of sale .........10 Percent paid in the month after the...
-
Programming Exercise 3.32 shows how to test whether a point is on the left side of a directed line, on the right, or on the same line. Write the methods with the following headers: Write a program...
-
The U.S. Census Bureau projects population based on the following assumptions: One birth every 7 seconds One death every 13 seconds One new immigrant every 45 seconds Write a program to display...
-
Define the Circle2D class that contains: Two double data fields named x and y that specify the center of the circle with getter methods. A data field radius with a getter method. A no-arg...
-
Let \(P(A \cap \bar{B})=0.3\) and \(P(\bar{B})=0.6\). Determine \(P(A \cup B)\).
-
Is it possible that for two events \(A\) and \(B\) with \(P(A)=0.4\) and \(P(B)=0.2\) the relation \(P(A \cap B)=0.3\) is true?
-
Check whether for 3 arbitrary random events \(A, B\), and \(C\) the following constellations of probabilities can be true: (1) \(P(A)=0.6, P(A \cap B)=0.2\), and \(P(A \cap \bar{B})=0.5\), (2)...
Study smarter with the SolutionInn App