Hello Jaycode365,
Thank you for the code in main.
I am still not sure where you might "pressing to start something".
I am thing that in main you show the user the price for "Full" ans "Self" and should give the user an opportunity to choose which price then call the appropriate function.
In the "pump?.Amount GasPrint" function there are some problems. to start with:
[codevoid GasPump::AmountGasPrint(int x)][/code] I believe that "x" would work better as a double and "y" also. Inside the while loop you do nothing to increase the value of "y" unless "m == 0" and sets "y" = "x" then the while loop would end and technically you would have pumped more then the tank you are trying to fill.
I also noticed that "TotalGas" was not coming up with the correct amount.
The two prompts do not make any sense.
std::cout << "\nEnter " << x << " to quit." << std::endl;
. You are using the value of "x" in this prompt which comes out as "Enter 11 to quit" and the following line is saying "Enter 11 to continue". You can not have it both ways. I am not even sure why you want the value of "x" there in the first place? Notice that a spaces in the quoted string before and after "x" makes it easier to read. The "\n" at the beginning helps to break up what is sent to the screen so you do not have line after line all run together.
I put a comment on the "cin" just to make things go a little faster. Even with it there I do not understand the need for it.
Your next function:
1 2 3 4
|
void GasPump::FillMain(double y) // Static Fn to fill main tank
{
m = y; //passing the argument.
}
|
I have not progressed far enough to get to this function, but I am having a hard time understanding how it works and what it is meant to do.
The next problem I had was with the use of "static" in the class. No matter what I tried I could not make it work, but I do not believe it is need in the first place. Still looking into that.
Once I removes all occurrences of "static" the program compiled and ran for me. I still have to figure out what is happening with:
1 2 3 4
|
AmountGas = AmountGas + 0.1;
ChargeGas = AmountGas * CostPerGallon;
TotalGas += AmountGas;
m -= TotalGas;
|
It looks like "TotalGas" should equal the value of "x" when it is finished. As I recall that is not what I saw on the screen.
I want to try some different things today and see what I get. I will let you know when I have something.
Hope that helps,
Andy