Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Car.java MrG 2012.1002
- public class Car
- {
- private double tank;
- private double efficiency;
- public Car(double efficiency)
- {
- tank = 0;
- this.efficiency = efficiency;
- }
- public double getGas()
- {
- return tank;
- }
- public void addGas(double amount)
- {
- tank = tank + amount;
- }
- public void drive(double miles)
- {
- tank = tank - miles/efficiency;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement