Last active
August 29, 2015 14:02
-
-
Save borncorp/e1f8bab70c2ba9186476 to your computer and use it in GitHub Desktop.
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 Bottle { | |
| int capacity; | |
| int used; | |
| String contains; | |
| String color; | |
| public Bottle(int capacitycopy, int usedcopy, String containscopy, String colorcopy) { | |
| this.capacity=capacitycopy; | |
| this.used=usedcopy; | |
| this.contains=containscopy; | |
| this.color=colorcopy; | |
| System.out.println("You have created a " | |
| + colorcopy | |
| + " bottle of " | |
| + containscopy | |
| + " .\nThe capacity is " | |
| + capacitycopy | |
| + ". Currently storing " | |
| + usedcopy | |
| + "ml"); | |
| } | |
| public void drink(int howmuch) { | |
| this.used=this.used-howmuch; | |
| System.out.println("You have drink " + howmuch + "ml of " + this.color + " " + this.contains + "\n" + this.used + "ml left"); | |
| } | |
| public void changeColor(String newcolor) { | |
| this.color=newcolor; | |
| System.out.println("The color of " + this.contains + " is now " + this.color); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment