The class Store has to implement the following functionalities 1 public class Store 2 { 3 4 //Fields TODO 5 6 //Initializes the fields of the store object 7 public Store(String shopName) 8 { 9 //TODO 10 } 11 12 //Adds a product with name = id and price = price to the catalogue of products sold by the StoreChain 13 //Returns true if the operation is successful (i.e., you can add a new product that doesn’t already exist) 14 public static boolean addNewProduct(String id, double price) 15 { 16 //TODO 17 } 18 19 //Removes a product from the catalogue of the StoreChain 20 //Returns the removed Product if the operation is successful (i.e, the product existed in the catalogue), null otherwise 21 public static Product removeFromCatalogue(String id) 22 { 23 //TODO 24 } 25 26 //Changes the price of a product in the catalogue of the StoreChain 27 //Returns true if the operation is successful (i.e., you reprice an existing product) 28 public static boolean repriceProduct(String id, double price) 29 { 30 //TODO 31 } 32 33 //Stocks a product (buys a certain quantity) in a store of the StoreChain If the product is already stocked in the store, adds the new quantity to the already available amount. 34 //Returns true if the operation is successful (i.e., the product is ( still) available in the catalogue of the StoreChain) 35 public boolean stockProduct(String id, int quantity) { 36 //TODO 37 } 38 39 //Sells a product from the store (reducing the quantity in the stock accordingly): a store could even sell a product which is still in its stock, but no longer available in the catalogue of the StoreChain 40 //Returns true if the operation is successful (ie., you have enough product to be sold) 41 public boolean sellProduct(String id, int quantity) { 42 //TODO 43 } 44 45 //Prints the contents of a catalogue: product name and price (one product per line) 46 public static void printCatalogue() { 47 //TODO 48 } 49 50 //Prints the stock of the current store object: product, price and quantity (one per line) 51 public void printStoreStock() { 52 //TODO 53 } 54 }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

The class Store has to implement the following functionalities

1 public class Store
2 {
3
4 //Fields TODO
5
6 //Initializes the fields of the store object
7 public Store(String shopName)
8 {
9 //TODO
10 }
11
12 //Adds a product with name = id and price = price to the catalogue of
products sold by the StoreChain
13 //Returns true if the operation is successful (i.e., you can add a new
product that doesn’t already exist)
14 public static boolean addNewProduct(String id, double price)
15 {
16 //TODO
17 }
18
19 //Removes a product from the catalogue of the StoreChain
20 //Returns the removed Product if the operation is successful (i.e, the
product existed in the catalogue), null otherwise
21 public static Product removeFromCatalogue(String id)
22 {
23 //TODO
24 }
25
26 //Changes the price of a product in the catalogue of the StoreChain
27 //Returns true if the operation is successful (i.e., you reprice an
existing product)
28 public static boolean repriceProduct(String id, double price)
29 {
30 //TODO
31 }
32
33 //Stocks a product (buys a certain quantity) in a store of the StoreChain
If the product is already stocked in the store, adds the new quantity
to the already available amount.
34 //Returns true if the operation is successful (i.e., the product is (
still) available in the catalogue of the StoreChain)
35 public boolean stockProduct(String id, int quantity) {
36 //TODO
37 }
38
39 //Sells a product from the store (reducing the quantity in the stock
accordingly): a store could even sell a product which is still in its
stock, but no longer available in the catalogue of the StoreChain
40 //Returns true if the operation is successful (ie., you have enough
product to be sold)
41 public boolean sellProduct(String id, int quantity) {
42 //TODO
43 }
44
45 //Prints the contents of a catalogue: product name and price (one product
per line)
46 public static void printCatalogue() {
47 //TODO
48 }
49
50 //Prints the stock of the current store object: product, price and
quantity (one per line)
51 public void printStoreStock() {
52 //TODO
53 }
54 }

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY