Week 12 Pair Exercise – Soda Machine You work for a game development company, and your company has asked you to build a prototype soda machine for use in multiple games on multiple platforms. To start, you have been asked to develop a simple class to represent the logic of your soda machine. To keep the soda machine relatively simple, your soda machine carries only one kind of soda. You designed a SodaMachine class that will describe your soda machine: Data attributes (these should be private instance variables of your class): stockLevel:int (number of beverages available in the soda machine) maxStock:int (max number of beverages the machine can hold) bevPrice:double (price of the beverage) bevLabel:String (name of the beverage stocked in the machine) changeAvailable:double (the amount of change available for making change) creditInserted:double (the amount of money inserted for purchasing beverages) Methods (these should be public): o A constructor that takes the following parameters: price:double § name:String Getter and setter methods for all instance variables (data attributes above) o Other methods: int addStock(int numberToAdd) void addCredit(double amountInserted) void addChange(double changeAdded) double returnChange()
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
305 Experts Online