subject

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).

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:40
Program using c++ only on visual studio pig is a simple two player dice game, played with one die. the first player to reach or surpass 50 is the winner. each player takes a turn rolling the dice. they add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. the risk being they could lose the amount they’ve accumulated into the pot. the rules for each player’s die roll. 1. roll the dice. a. if user rolled a 1, i. the pot gets set to zero ii. the other player goes to step 1. b. a roll of 2-6 is added to the pot. 2. user can choose to hold or roll again. a. choice roll. return to step 1. b. choice hold. i. increment player score by the pot amount. ii. pot gets set to 0. iii. second player gets to roll and goes to step 1. program requirements: ● before each opponent begins ○ output the score for the person and the computer. ○ output the opponents whose turn is beginning and ask the user to hit enter to continue. ● with each dice roll. ○ output the die value, and amount of the round pot. ○ if it’s the users roll ask if they want to roll again ( r ) or hold ( h ). your program should allow r, r, h or h as valid input. if input is anything else, ask the user again until valid input is obtained. ○ the ai will continue playing until the round pot is 20 or more. ● once a player’s score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or not. ● once there is a winner ○ score totals are output along with who the winner was. user or computer ○ player is asked if they want to play again y or n. valid input should be y, y, or n, n. ● when a new game starts the starting roll goes to the player that did not roll last. if the user rolled last in the previous game, then the computer rolls first and vice versa. when the program first begins, the player will make the first roll of the first game. development notes : ● you will need a way to roll dice in your program. the rand() function works well, but returns an integer. if we want numbers 0 – 9 we can get the value modulus 10. ● call srand() with a value to seed it. it’s common to seed it with the current computer clock, include ctime, and then call srand(time(
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
To produce a starlight effect in her photograph, lina should choose the filter for her camera.
Answers: 1
question
Computers and Technology, 24.06.2019 00:20
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
In which view can you see speaker notes?
Answers: 1
You know the right answer?
Write the implementation (cpp file) of the GasTank class of the
previous exercise. The full s...
Questions