Answer to Question #256975 in Java | JSP | JSF for Chakalaka

Question #256975

The SRC representative on student entertainment and welfare has been informed of your newly acquired knowledge in application development and have approached you to create a stable management system for the vending machine. The system is meant to help the vending machine’s owner in managing its stock and finances, with this in mind your application should then allow for the user to enter a code which is either linked to an item or the pin code used by the owner. If an item code is entered the balance/cost for that item is displayed prompting the user for how many items they what to buy, however if the owner’s pin is entered then an admin menu is displayed. The landing page should give a brief description of the vending machine such as the Name, address and random items in stock and prices


1
Expert's answer
2021-10-26T09:14:34-0400
import java.util.HashMap;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    HashMap<Integer, Thing> map;
    while (true) {
      String cmd = s.next();
      if (cmd.trim().equals("add")) {
        addNewThing();
      } else if (cmd.trim().equal("show")) {
        showOldThing();
      } else {
        System.out.println("Invalid command!");
      }
    }
  }
  public static void addNewThing() {} // todo implement
  public static void showOldThing() {} // todo implement
}

class Thing {
  private long id;
  private String name;
  public void setID(long id) { this.id = id; }
  public long getID() { return id; }
  public void setName(String name) { this.name = name; }
  public String getName() { return name; }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS