Computers and Technology
Computers and Technology, 05.05.2020 04:26, 18alewis

Write the implementation (cpp file) of the GasTank class of the
previous exercise. The full specification of the class is:.
1. A data member named amount of type double.
2. An data member named capacity of type double.
3. A constructor that accepts a parameter of type double. The value
of the parameter is used to initialize the value of capacity. The
constructor also sets amount to zero.
4. A function named add Gas that accepts a parameter of type double.
The value of the amount instance variable is increased by the value of
the parameter. However, if the value of amount is increased beyond
the value of capacity, amount is set to capacity.
5. A function named use Gas that accepts a parameter of type double.
The value of the amount data member is decreased by the value of
the parameter. However, if the value of amount is decreased below 0,
amount is set to 0.
6. A function named is Empty that accepts no parameters and returns a
boolean value. is Empty returns true if the value of amount is less than
0.1, and false otherwise.
7. A function named is Full that accepts no parameters and returns a
boolean value.. is Full returns true if the value of amount is greater
than capacity-0.1, and false otherwise.
8. A function named get Gas Level that accepts no parameters.
Get Gas Level returns the value of the amount data member.
9. A function named fillUp that accepts no parameters and returns
a double. fillUp increases amount to capacity and returns the
difference between the value of capacity and the original value
of amount (that is, the amount of gas that is needed to fill the tank to
capacity).

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:40, StephiUnicorni
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
image
Computers and Technology, 22.06.2019 22:00, lgary9462
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass. cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array. c . run this program and observe the results.
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, hannahrasco4051
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
image
Computers and Technology, 23.06.2019 09:00, amberpublow7
Which best describes the role or restriction enzymes in the analysis of edna a. to break dna into fragments that vary in size so they can be sorted and analyzed b. to amplify small amounts of dna and generate large amounts of dna for analysis c. to purify samples of dna obtained from the environment so they can be analyzed d. to sort different sizes of dna fragments into a banding pattern that can be analyzed
Answers: 1
Do you know the correct answer?
Write the implementation (cpp file) of the GasTank class of the
previous exercise. The full s...

Questions in other subjects: