Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public abstract class Appliance extends Product{ private int wattage; private String color; private String brand; public Appliance(double initPrice, int initQuantity, int initWattage, String initColor, String
public abstract class Appliance extends Product{ private int wattage; private String color; private String brand; public Appliance(double initPrice, int initQuantity, int initWattage, String initColor, String initBrand){ super(initPrice, initQuantity); wattage = initWattage; color = initColor; brand = initBrand; } public String getColor(){ return color; } public String getBrand(){ return brand; } public int getWattage(){ return wattage; } }
public abstract class Computer extends Product{ private double cpuSpeed; private int ram; private boolean ssd; private int storage; public Computer(double initPrice, int initQuantity, double initCPUSpeed, int initRAM, boolean initSSD, int initStorage){ super(initPrice, initQuantity); cpuSpeed = initCPUSpeed; ram = initRAM; ssd = initSSD; storage = initStorage; } public double getCPUSpeed(){ return cpuSpeed; } public int getRAM(){ return ram; } public boolean getSSD(){ return ssd; } public int getStorage(){ return storage; } }
public class Desktop extends Computer{ String towerProfile; public Desktop(double initPrice, int initQuantity, double initCPUSpeed, int initRAM, boolean initSSD, int initStorage, String initProfile){ super(initPrice, initQuantity, initCPUSpeed, initRAM, initSSD, initStorage); towerProfile = initProfile; } public String toString(){ String result = towerProfile + " Desktop PC with " + getCPUSpeed() + "ghz CPU, " + getRAM() + "GB RAM, " + getStorage() + "GB "; if(getSSD()){ result += "SSD drive."; }else{ result += "HDD drive."; } return result; } }
import java.util.ArrayList; import java.util.Scanner; public class ElectronicStore{ public final int MAX_PRODUCTS = 10; //Maximum number of products the store can have private int curProducts; String name; Product[] stock; //Array to hold all products double revenue; public ElectronicStore(String initName){ revenue = 0.0; name = initName; stock = new Product[MAX_PRODUCTS]; curProducts = 0; } public String getName(){ return name; } //Adds a product and returns true if there is space in the array //Returns false otherwise public boolean addProduct(Product newProduct){ if(curProducts = 0 && index
public class Fridge extends Appliance{ double cubicFeet; boolean hasFreezer; public Fridge(double initPrice, int initQuantity, int initWattage, String initColor, String initBrand, double initFeet, boolean initFreezer){ super(initPrice, initQuantity, initWattage, initColor, initBrand); cubicFeet = initFeet; hasFreezer = initFreezer; } public String toString(){ String result = cubicFeet + " cu. ft. " + getBrand() + " Fridge "; if(hasFreezer){ result += "with Freezer "; } result += "(" + getColor() + ", " + getWattage() +" watts)"; return result; } }
public class Laptop extends Computer{ private double screenSize; public Laptop(double initPrice, int initQuantity, double initCPUSpeed, int initRAM, boolean initSSD, int initStorage, double initScreen){ super(initPrice, initQuantity, initCPUSpeed, initRAM, initSSD, initStorage); screenSize = initScreen; } public String toString(){ String result = screenSize + " inch Laptop PC with " + getCPUSpeed() + "ghz CPU, " + getRAM() + "GB RAM, " + getStorage() + "GB "; if(getSSD()){ result += "SSD drive."; }else{ result += "HDD drive."; } return result; } }
public class Product{ private double price; private int quantity; public Product(double initPrice, int initQuantity){ price = initPrice; quantity = initQuantity; } public int getQuantity(){ return quantity; } public double getPrice(){ return price; } //Returns the total revenue (price * amount) if there are at least amount items in stock //Return 0 otherwise (i.e., there is no sale completed) public double sellUnits(int amount){ if(amount > 0 && quantity >= amount){ quantity -= amount; return price * amount; } return 0.0; } }
public class ToasterOven extends Appliance{ private int width; private boolean convection; public ToasterOven(double initPrice, int initQuantity, int initWattage, String initColor, String initBrand, int initWidth, boolean initConvection){ super(initPrice, initQuantity, initWattage, initColor, initBrand); width = initWidth; convection = initConvection; } public String toString(){ String result = width + " inch " + getBrand() + " Toaster "; if(convection){ result += "with convection "; } result += "(" + getColor() + ", " + getWattage() +" watts)"; return result; } }1) The GUI Create a class called ElectronicStoreApp (extend JavaFX's Application class), which will construct the GUI shown below. You should make the GUI window non-resizable. The ratio of the window width/height should be approximately 2:1 (e.g., 800 wide, 400 high). Electronic Store Application Store Summary: Store Stock Current Cart # Sales: Revenue: $/Sale: Most Popular Items: Reset Store Add to Cart Remove from Cart Complete Sale 1) The GUI Create a class called ElectronicStoreApp (extend JavaFX's Application class), which will construct the GUI shown below. You should make the GUI window non-resizable. The ratio of the window width/height should be approximately 2:1 (e.g., 800 wide, 400 high). Electronic Store Application Store Summary: Store Stock Current Cart # Sales: Revenue: $/Sale: Most Popular Items: Reset Store Add to Cart Remove from Cart Complete Sale
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started