COMP2396
Loading...
Searching...
No Matches
CmdInsertCoin Class Reference
Inheritance diagram for CmdInsertCoin:
Collaboration diagram for CmdInsertCoin:

Public Member Functions

String execute (VendingMachine v, String[] cmdParts)
 
- Public Member Functions inherited from Command

Detailed Description

Definition at line 1 of file CmdInsertCoin.java.

Member Function Documentation

◆ execute()

String CmdInsertCoin.execute ( VendingMachine v,
String[] cmdParts )
inline

Implements Command.

Definition at line 4 of file CmdInsertCoin.java.

4 {
5 Integer c = Integer.valueOf(cmdParts[1]);
6 // Add the coin to Coin Slot
7 v.insertCoin(c);
8 // Do something
9 // return a string "Inserted a $x coin. $y in total."
10 return "Inserted a $" + c + " coin. $" + v.getTotalInsertedCoinsAmount() + " in total.";
11 // x and y must be replaced by an appropriate value
12
13 }
void insertCoin(Integer c)
int getTotalInsertedCoinsAmount()

References VendingMachine.getTotalInsertedCoinsAmount(), and VendingMachine.insertCoin().

Here is the call graph for this function:

The documentation for this class was generated from the following file: