// function to order a cake, accepts topping order list, size and quantity values public void orderCake(String[] topping

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

// function to order a cake, accepts topping order list, size and quantity values public void orderCake(String[] topping

Post by answerhappygod »

Function To Order A Cake Accepts Topping Order List Size And Quantity Values Public Void Ordercake String Topping 1
Function To Order A Cake Accepts Topping Order List Size And Quantity Values Public Void Ordercake String Topping 1 (50.53 KiB) Viewed 10 times
Function To Order A Cake Accepts Topping Order List Size And Quantity Values Public Void Ordercake String Topping 2
Function To Order A Cake Accepts Topping Order List Size And Quantity Values Public Void Ordercake String Topping 2 (50.53 KiB) Viewed 10 times
Function To Order A Cake Accepts Topping Order List Size And Quantity Values Public Void Ordercake String Topping 3
Function To Order A Cake Accepts Topping Order List Size And Quantity Values Public Void Ordercake String Topping 3 (55.61 KiB) Viewed 10 times
// function to order a cake, accepts topping order list, size and quantity values public void orderCake(String[] toppingOrder, int quantity, int size) { this.toppingOrder = toppingOrder.clone(); this.size = size; this.quantity = quantity; } // function to return price according to size of cake public double getSizePrice() { if (size== 1) return priceSmall; else if (size==2) return priceMedium; else return priceBig; } // function to return total price public double getTotalPrice() { } // function to return a string representation of size public String getSize() { if(size == 1) return "Small"; else if(size == 2) return "Medium"; else return "Big"; } totalPrice=(getSizePrice()* quantity+(toppingOrder.length*10)); return totalPrice;
// function to order a cake, accepts topping order list, size and quantity values public void orderCake(String[] toppingOrder, int quantity, int size) { this.toppingOrder = toppingOrder.clone(); this.size = size; this.quantity = quantity; } // function to return price according to size of cake public double getSizePrice() { if (size== 1) return priceSmall; else if (size==2) return priceMedium; else return priceBig; } // function to return total price public double getTotalPrice() { } // function to return a string representation of size public String getSize() { if(size == 1) return "Small"; else if(size == 2) return "Medium"; else return "Big"; } totalPrice=(getSizePrice()* quantity+(toppingOrder.length*10)); return totalPrice;
BY USING JAVA: 1. Create the GUI application for Cake Order. 2. Save (add) order into a text file. 3. Implement an exception handling. Can you please make a Gui based on the class that I gave. But make sure the class is still there just make a gui for the given classes and save it to a text file and also implement an exception handling into the code. You may add any other function to it. Thank you in advance. I will sure to give you thumbs up. public class Cake{ // declaring required variables private String name; private String[] topping; private String[] toppingOrder; private double priceSmall; private double priceMedium; private double priceBig; private double totalPrice; private int size; private int quantity; // parameterized constructor public Cake(String name) { this.name=name; } // function to set topping list and different price values public void setCake(String[] topping, double priceSmall, double this.topping = topping.clone(); this.priceSmall = priceSmall; this.priceMedium = priceMedium; this.priceBig = priceBig; priceMedium,double priceBig) { }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply