Someone help me , based on the java code given , how to draw the UML class diagram.
import java.util.Scanner; public static void main(String [] args) Food[] foodArray = new Food[4]; foodArray[0] = new Juice("Apple","C01",5.00, "Which is very popular juice in our shop.","Apple",1);
boolean loopagain = true; while(loopagain){ System.out.println("1.\t Display Food"); double total=0; Scanner in = new Scanner(System.in); int choice=in.nextInt(); switch (choice) { Scanner on = new Scanner(System.in); switch(food_choice){ case 2:Scanner ordercode = new Scanner(System.in);
break; double addprice=addorderprocess(foodArray,add); break; double dltprice=dltorderprocess(foodArray,dlt); case 0: System.out.println("Bye"); } public static void displayJuice(Food[] foodArray){ if (foodArray[i] instanceof Juice){ System.out.println("\nJuice\n============"); public static void displaySnack(Food[] foodArray){ for (int i = 0; i < foodArray.length; ++i) { if (foodArray[i] instanceof Snack){ System.out.println("\nSnack\n============"); public static double orderprocess(Food[] foodArray,String code){ public static double addorderprocess(Food[] foodArray,String add){ public static double dltorderprocess(Food[] foodArray,String dlt){
class Snack extends Food{ public Snack(){ public Snack(String name, String code, double price,String description ,String packing,String size ){ public String toString(){
class Juice extends Food{ public Juice(){ public Juice(String name, String code, double price,String description, String flavor,int cup){
abstract class Food{ public Food(){ public Food(String name ,String code,double price,String description){ this.name = name ;
public void setcode(String code){ public void setprice(Double price){ public void setdescription(String description){ public String getname(){ public String getcode(){ public Double getprice(){ public String getdescription(){ public String toString(){
|
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 8 images
- JAVA programming languagearrow_forward1 public class Main { 1234567 7 8 9 10 11 ENERGET 12 13 14 15 16 17 18} public static void main(String[] args) { String present = ""; double r = Math.random(); // between 0 and 1 if (r > >>arrow_forward1. Insert the missing part of the code below to output the string. public class MyClass { public static void main(String[] args) { ("Hello, I am a Computer Engineer");arrow_forward
- public class Qla { Run | Debug public static void main (String [] args) { int n = 1000; int mySum 0; %3D for (int i = n; i >= 0; i--) { %3D if (i % 2 == 0) { mySum += i; } } Stdout.println(mySum);arrow_forwardclass Lab4Q1P3 { public static void main(String args[]) { int max = 10;while (max < 10) {System.out.println("count down: " + max);max--;}}} Do you know what is wrong with the program? I know that there is error on the 7th line but I don't know what to fix.arrow_forwardpublic class main { public static void main(String [] args) { Dog dog1=new Dog(“Spark”,2),dog2=new Dog(“Sammy”,3); swap(dog1, dog2); System.out.println(“dog1 is ”+ dog1); System.out.println(“dog2 is ”+ dog2); } public static void swap(Dog a, Dog b) { String nameA = a.getName(); String nameB = b.getName(); a.setName(nameB); b.setName(nameA); } What is the output of the main()?arrow_forward
- public class Test { } public static void main(String[] args) { String str = "Salom"; System.out.println(str.indexOf('t)); }arrow_forwardimport java.util.Scanner;public class MP2{public static void main (String[] args){//initialization and declarationScanner input = new Scanner (System.in);String message;int Option1;int Option2;int Quantity;int TotalBill;int Cash;int Change;final int SPECIALS = 1;final int BREAKFAST = 2;final int LUNCH = 3;final int SANDWICHES = 4;final int DRINKS = 5;final int DESSERTS = 6;//For the Special, Breakfast, Lunch Optionsfinal int Meals1 = 11;final int Meals2 = 12;final int Meals3 = 13;final int Meals4 = 14;//First menu and First OptionSystem.out.println("\t Welcome to My Kitchen ");System.out.println("\t\t SPECIALS");System.out.println("\t\t [2] BREAKFAST MEALS");System.out.println("\t\t [3] LUNCH MEALS");System.out.println("\t\t [4] SANDWICHES");System.out.println("\t\t [5] DRINKS");System.out.println("\t\t [6] DESSERTS");System.out.println("\t\t [0] EXIT");System.out.print("Choose an option ");Option1 = input.nextInt();//first switch case statementsswitch(Option1){case (SPECIALS):message…arrow_forward2-7 Given the code below, which lines are valid and invalid.arrow_forward
- Math 130 Java programming Dear Bartleby, I am a student beginning in computer science. May I have some assistance on this lab assignment please? Thank you.arrow_forwarduse the JCreator program for code in picture and show the outputarrow_forwardjava programming I would like my order to include the option for the user to tip the restaurant if they like to. Can this be added? import java.util.*; public class Restaurant2 { publicstaticvoidmain(String[] args) { // Define menu items and pricesString[] menuItems= {"Apple", "Orange", "Pear", "Banana", "Kiwi", "Strawberry", "Grape", "Watermelon", "Cantaloupe", "Mango"};double[] menuPrices= {1.99, 2.99, 3.99, 4.99, 5.99, 6.99, 7.99, 8.99, 9.99, 10.99};StringusersName; // The user's name, as entered by the user.ArrayList<String> arr = new ArrayList<>(); // Define scanner objectScanner input=new Scanner(System.in); // Welcome messageSystem.out.println("Welcome to AppleStoreRecreation, what is your name:");usersName = input.nextLine(); System.out.println("Hello, "+ usersName +", my name is Patrick nice to meet you!, May I Take Your Order?"); // Display menu items and pricesfor (inti=0; i <menuItems.length; i++) {System.out.println(menuItems[i] +": $"+ menuPrices[i]);}…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY