Now we want to create an Object oriented System for a shopping mall. It has Items with name, manufacturer and price. Provide constructors. Getters, setters, toString methods. We add several items to Store. For that create a store class having name and arraylist of items, Provide Constructors, getters/setters and toString(), in addition you have to provide a method add which add new item to the array. The main function that does these things looks as follows: Public static void main(Strings[] args) { Item shampoo2(“pantene”, “Procter & Gamble”,100), noodles(“Noodles”, “knorr”, 50); // add further items. Store abcSuperStore; abcSuperStore.add(shampoo2); abcSuperStore.add(noodles); … abcSuperStore.sale(shampoo2); a bcSuperStore.sale(noodles);
Now we want to create an Object oriented System for a shopping mall. It has Items with name, manufacturer and price. Provide constructors. Getters, setters, toString methods.
We add several items to Store. For that create a store class having name and arraylist of items, Provide Constructors, getters/setters and toString(), in addition you have to provide a method add which add new item to the array.
The main function that does these things looks as follows:
Public static void main(Strings[] args) {
Item shampoo2(“pantene”, “Procter & Gamble”,100), noodles(“Noodles”, “knorr”, 50);
// add further items.
Store abcSuperStore;
abcSuperStore.add(shampoo2);
abcSuperStore.add(noodles); …
abcSuperStore.sale(shampoo2); a
bcSuperStore.sale(noodles);
Step by step
Solved in 3 steps with 1 images