This uses Inheritance
Im am doing inheritance on the console line, and well all is semi ok. But what im confused on is how do this in a windows design.
I am trying to complete something, but I dont even know where to start.
I was hoping someone could help me. Here are what I need for classes. And what they have to do. of course this all posts up on a listbox.
Ive tried this with console and for the most part i got it working, but it was static info in the code, but the same setup in windows i have no clue.
The base class will be Vehicle. The Car and Truck classes will inherit from the Vehicle class. The Vehicle class will be composed of an object of the FuelTank class. The FuelTank class has 2 attribute variables: (mTankCapacity and mCurrentValue).
In addition to the FuelTank object, the attribute variables of the Vehicle class are: mVehID, mDesc, mOdometer, and mMPG. In addition to setting up properties for the variables as needed, the Vehicle class has the following methods: AddFuel() - receives the amount of fuel to be added to the tank and adds that to the tank if the tank will hold it. If it will, it returns a true; otherwise, a false. FillTank() – fills the tank and returns a string indicating the amount of gallons added to the tank.
The attribute variable of the Car class is mNumRiders. The methods of the Car class are: getMPG() – a method that calculates the current MPG. The MPG is reduced by 2% for every rider over 1. (For example if the car's mpg is 28.5 and there are 5 riders, the current mpg is 26.22). MoveForward() – receives the mileage to move forward. The method determines if there is enough fuel to make the trip. If not, it returns false. If there is enough fuel to make the trip, the mileage is added to the odometer and the gas tank is reduced by the amount of gas needed for the trip.
The attribute variable of the Truck class is mLoadLbs. The methods of the Truck class are: getMPG() – a method that calculates the current MPG. The MPG is reduced by 3% for every thousand pounds if the load is >= 1,000 pounds. For example if the truck's mpg is 13.4 and is loaded with 4000 pounds, the current mpg is 11.79. Another example is if the truck's mpg is 13.4 loaded with 500 pounts, the current mpg is 13.4. MoveForward() – receives the mileage to move forward. The method determines if there is enough fuel to make the trip. If not, it returns false. If there is enough fuel to make the trip, the mileage is added to the odometer, the gas tank is reduced by the amount of gas needed for the trip, and the method returns true.
So thats the classes, go give a visual refrence there is a listbox, a move forward button and a add fuel button.
I would honestly love the help on where to go with this, I am so lost but yet i really need to see a sample of this coded. All the samples I have are in console (look around the web and they all are) I would just like to see a sample like this in a windows format, seeing how its way more confusing.
Please I am really looking for help, if you wish to email me then fine, or something. As long as i can figure out how this dumb program goes. This is what you get when you get a lab book to teach your self but no teacher edition. *sigh* I look forward to your help.