Class GroceryTrip
Object
GroceryTrip
This class creates a Scanner and GroceryList object to make an "App"
for the GroceryList. Once begun, you issue commands to invoke different
methods.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionLoop(String action) Loop that uses and sets the action parameter each iteration.voidGets user input and adds grocery depending on provided String.Gets the Scanner object's next line.voidPrints all groceries within a certain user-specified aisle.voidPrints entire Grocery List.voidWelcomes and prints options for GroceryTrip user.voidGets user input and removes grocery depending on provided String.voidPrints the totals associated with the Grocery List.
-
Field Details
-
scnr
Scanner scnr -
grocList
GroceryList grocList
-
-
Constructor Details
-
GroceryTrip
public GroceryTrip()
-
-
Method Details
-
printOptions
public void printOptions()Welcomes and prints options for GroceryTrip user. -
getAction
Gets the Scanner object's next line.- Returns:
- First letter of Scanner.nextLine()
-
actionLoop
Loop that uses and sets the action parameter each iteration. Depending on the action, calls a different method for operations. -
addAction
public void addAction()Gets user input and adds grocery depending on provided String. -
removeAction
public void removeAction()Gets user input and removes grocery depending on provided String. -
printAction
public void printAction()Prints entire Grocery List. -
getAisleAction
public void getAisleAction()Prints all groceries within a certain user-specified aisle. -
totalAction
public void totalAction()Prints the totals associated with the Grocery List.
-