Part (1)Define a class with the following specifications: a. The class name is FuelTank with three private data members: - content (double): represents the tank capacity measured in liter. b. Define a private method called : represents fuel level if its low or not usured in liter. i. Step 1: compute the fuel percentage asevel() that does the following boolean (true or false) ii. Step 2: update the Fuel Percentage follows: otherwise, lowI the private lowLevel c. Define a constructor that accepts be false variable to true if the fuel percentage is less than 10% , capacity and content private data members capacity and content as input parameters to initialize the d. Define a public method called upers and call the method defined in part (b) to update lowLevel parameter (it might be either positive or fuelContent ( ) that accepts fuelAmount (double) as input i. Step 1: Add the fuelAmount to content data The method does the following steps: ii. Step 2: In case the new value of content exceeds capacity, set content to capacity. iv. Step 4: update the lowr value of content becomes negative, set content to Zero. e. Provide an accessor (get) method variable by calling the method defined in (b) data member. 2w Level data member and a mutator (set) method for capacity below:
Part (1)Define a class with the following specifications: a. The class name is FuelTank with three private data members: - content (double): represents the tank capacity measured in liter. b. Define a private method called : represents fuel level if its low or not usured in liter. i. Step 1: compute the fuel percentage asevel() that does the following boolean (true or false) ii. Step 2: update the Fuel Percentage follows: otherwise, lowI the private lowLevel c. Define a constructor that accepts be false variable to true if the fuel percentage is less than 10% , capacity and content private data members capacity and content as input parameters to initialize the d. Define a public method called upers and call the method defined in part (b) to update lowLevel parameter (it might be either positive or fuelContent ( ) that accepts fuelAmount (double) as input i. Step 1: Add the fuelAmount to content data The method does the following steps: ii. Step 2: In case the new value of content exceeds capacity, set content to capacity. iv. Step 4: update the lowr value of content becomes negative, set content to Zero. e. Provide an accessor (get) method variable by calling the method defined in (b) data member. 2w Level data member and a mutator (set) method for capacity below:
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 5E
Related questions
Concept explainers
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Question
Part (1)Define a class with the following specifications: a. The class name is FuelTank with three private data members: - content (double): represents the tank capacity measured in liter. b. Define a private method called : represents fuel level if its low or not usured in liter. i. Step 1: compute the fuel percentage asevel() that does the following boolean (true or false) ii. Step 2: update the Fuel Percentage follows: otherwise, lowI the private lowLevel c. Define a constructor that accepts be false variable to true if the fuel percentage is less than
10%
, capacity and content private data members capacity and content as input parameters to initialize the d. Define a public method called upers and call the method defined in part (b) to update lowLevel parameter (it might be either positive or fuelContent
(
) that accepts fuelAmount (double) as input i. Step 1: Add the fuelAmount to content data The method does the following steps: ii. Step 2: In case the new value of content exceeds capacity, set content to capacity. iv. Step 4: update the lowr value of content becomes negative, set content to Zero. e. Provide an accessor (get) method variable by calling the method defined in (b) data member. 2w Level data member and a mutator (set) method for capacity below:
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,