[Solved]Java Specification First Couple Images Specification Sample Output Others Structure Someon Q37052535
Java Specification: First couple images are the specificationand sample output and the others is the structure. Can someone helpcode this, thanks!








Thanks for your help!
Student Specification Main class: Store A store sells a number of products. The initial stock is shown below:: Name Stock Price $1.50 $5.00 100 $1.50 100 $1.50 100 $1.50 Whiteboard Marker 85 Whiteboard Eraser 45 Black Pen Red Pen Blue Pein The store has a cash register which stores all cash from sales of the store’s product. The store clerk uses the following menu: 1. sell 2. restock 3. view stock 4. view cash 5. prune products 6. exit The “prune products” option removes all products with zero stock from the store Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser – 45 at $5.00 Black Pen – 100 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice 〈s/r/v/c/p/X): s Name: Whiteboard Eraser Selling Whiteboard Eraser Number: 46 Not enough stock Choice 〈s/r/v/c/p/X): s Name: Whiteboard Eraser Selling Whiteboard Eraser Number 45 Choice (s/r/v/c/p/x): s Name: Red Pen Selling Red Pen Number: 100 Choice 〈s/r/v/c/p/X): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser – 0 at $5.00 Black Pen – 100 at $1.50 Red Pen – 0 at $1.50 Blue Pen – 100 at $1.50 Choice 〈s/r/v/c/p/X): P Choice (s/r/v/c/p/x): r Name Blue Pen Restocking Blue Pen Number: 5 Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Black Pen – 100 at $1.50 Blue Pen – 105 at $1.50 Choice (s/r/v/c/p/x): s Name: Pie No such product Choice (s/r/v/c/p/X): c Cash: $375.00 Choice (s/r/v/c/p/x): x In addition to the basic functionality above, your program should also satisfy the following requirements: The “seir option prints an errori the selected product is not lound – The “sell” option ignores the case of the product name (e.g. bLaCk pEn) . The “sell” option allows the product name to be partially entered. e.g. Entering “red” will sell a “Red Pen”. Entering “pen” will instead show a list of matching products (Black Pen, Red Pen, Blue Pen) The “restock” option also allows a partial product name to be entered. All matching products will be restocked. The “restock” option, if given a product name that doesn’t exist, wll automatically create and add a new product with that name. Sample VO: Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser – 45 at $5.00 Black Pen – 100 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice (s/r/v/c/p/x): s Name: Green Pen No such product Choice (s/r/v/c/p/x): s Name: black PEN Selling Black Pen Number: 1 Choice (s/r/v/c/p/x): s Name: pen Multiple products match: Black Pen – 98 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice (s/r/v/c/p/x): s Name: black Selling Black Pen Number: 1 Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser 45 at $5.00 Black Pen – 98 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice (s/r/v/c/p/x): r Name: whiteboard Restocking Whiteboard Marker Number: 3 Restocking Whiteboard Eraser Number: 2 Choice (s/r/v/c/p/x): r Name: Green Pen Adding new product Number: 30 Price: $2.30 Choice (s/r/v/c/p/x) v Whiteboard Marker – 88 at $1.50 Whiteboard Eraser – 47 at $5.00 Black Pen – 98 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Green Pen – 30 at $2.30 Choice (s/r/v/c/p/x): x CashRegister In Product Store public class Product f private String name; private int stock; private double price; public Product (String name, int stock, double price) // insert 3 lines of code to initialise the fields public String getName() return “” public boolean isEmpty() return false; *Return true iff this product has at least n stock public boolean has(int n) return true; * Sell n stock of this product (decrease stock by n) * and return the amount of money earned (price n) public double sell(int n) return 0.0; * Increase stock by n. public void restock (intn) f @Override public String toString() return name-“stock+”at $”+formatted(price); private String formatted(double money) < DecimalFormat(“###,##0.00”). format(money); return new public class CashRegister private double cash; public CashRegister)f public void add(double money){ @override public String toString() f return “Cash: $”formatted (cash) private String formatted (double amount) DecimalFormat (“###,##0.00”).format(amount); return new public class Store private CashRegister cashRegister; private LinkedList<Product> products new LinkedList<Product>; public Store() /Insert 6 lines of code to initialise the fields private char readChoice)f returnx private void sell) { private void restock) private void viewStock () private void viewCash() f private void pruneProducts() private String readName () return “No Name” private double readPrice()f return 0.0; private int readNumber() return 0 private void help() System.out.println( “Menu options”); System.out.println(“ssell”); System.out.println(“r -restock”); System.out.println(“vview stock” System.out.println(“cview cash System.out.println(“pprune products”); System.out.println(“x – exit”); Show transcribed image text Student Specification Main class: Store A store sells a number of products. The initial stock is shown below:: Name Stock Price $1.50 $5.00 100 $1.50 100 $1.50 100 $1.50 Whiteboard Marker 85 Whiteboard Eraser 45 Black Pen Red Pen Blue Pein The store has a cash register which stores all cash from sales of the store’s product. The store clerk uses the following menu: 1. sell 2. restock 3. view stock 4. view cash 5. prune products 6. exit The “prune products” option removes all products with zero stock from the store
Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser – 45 at $5.00 Black Pen – 100 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice 〈s/r/v/c/p/X): s Name: Whiteboard Eraser Selling Whiteboard Eraser Number: 46 Not enough stock Choice 〈s/r/v/c/p/X): s Name: Whiteboard Eraser Selling Whiteboard Eraser Number 45 Choice (s/r/v/c/p/x): s Name: Red Pen Selling Red Pen Number: 100 Choice 〈s/r/v/c/p/X): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser – 0 at $5.00 Black Pen – 100 at $1.50 Red Pen – 0 at $1.50 Blue Pen – 100 at $1.50 Choice 〈s/r/v/c/p/X): P Choice (s/r/v/c/p/x): r Name Blue Pen Restocking Blue Pen Number: 5 Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Black Pen – 100 at $1.50 Blue Pen – 105 at $1.50 Choice (s/r/v/c/p/x): s Name: Pie No such product Choice (s/r/v/c/p/X): c Cash: $375.00 Choice (s/r/v/c/p/x): x
In addition to the basic functionality above, your program should also satisfy the following requirements: The “seir option prints an errori the selected product is not lound – The “sell” option ignores the case of the product name (e.g. bLaCk pEn) . The “sell” option allows the product name to be partially entered. e.g. Entering “red” will sell a “Red Pen”. Entering “pen” will instead show a list of matching products (Black Pen, Red Pen, Blue Pen) The “restock” option also allows a partial product name to be entered. All matching products will be restocked. The “restock” option, if given a product name that doesn’t exist, wll automatically create and add a new product with that name.
Sample VO: Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser – 45 at $5.00 Black Pen – 100 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice (s/r/v/c/p/x): s Name: Green Pen No such product Choice (s/r/v/c/p/x): s Name: black PEN Selling Black Pen Number: 1 Choice (s/r/v/c/p/x): s Name: pen Multiple products match: Black Pen – 98 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice (s/r/v/c/p/x): s Name: black Selling Black Pen Number: 1 Choice (s/r/v/c/p/x): v Whiteboard Marker – 85 at $1.50 Whiteboard Eraser 45 at $5.00 Black Pen – 98 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Choice (s/r/v/c/p/x): r Name: whiteboard Restocking Whiteboard Marker Number: 3 Restocking Whiteboard Eraser Number: 2 Choice (s/r/v/c/p/x): r Name: Green Pen Adding new product Number: 30 Price: $2.30 Choice (s/r/v/c/p/x) v Whiteboard Marker – 88 at $1.50 Whiteboard Eraser – 47 at $5.00 Black Pen – 98 at $1.50 Red Pen – 100 at $1.50 Blue Pen – 100 at $1.50 Green Pen – 30 at $2.30 Choice (s/r/v/c/p/x): x
CashRegister In Product Store
public class Product f private String name; private int stock; private double price; public Product (String name, int stock, double price) // insert 3 lines of code to initialise the fields public String getName() return “” public boolean isEmpty() return false; *Return true iff this product has at least n stock public boolean has(int n) return true; * Sell n stock of this product (decrease stock by n) * and return the amount of money earned (price n) public double sell(int n) return 0.0; * Increase stock by n. public void restock (intn) f @Override public String toString() return name-“stock+”at $”+formatted(price); private String formatted(double money)
Expert Answer
Answer to Java Specification: First couple images are the specification and sample output and the others is the structure. Can som… . . .
OR

