Last active
August 29, 2015 14:26
-
-
Save jraczak/7b1569b05fd93a1bf726 to your computer and use it in GitHub Desktop.
Implementing classes & methods - implementing a method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Car | |
{ | |
private double milesDriven; | |
private double gasInTank; | |
public void drive(double distance) | |
{ | |
milesDriven = milesDriven + distance; | |
} | |
public void addGas(double amount) | |
{ | |
gasInTank = gasInTank + amount; | |
} | |
// Additional methods fill in below | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment