Question
package cn.FOrdering; import java.util.scanner; public class students_order { public static void main (string [] args) { scanner input=new scanner (system.in); string [] dishnames={ ,
package cn.FOrdering; import java.util.scanner; public class students_order {
public static void main (string [] args) { scanner input=new scanner (system.in);
string [] dishnames={" ", " ", " ", " ", " "} double [] prices={15.0, 30.0, 35.0, 90.0, 20.0}; int [] praisenums=new int [5]; string [] names=new string [5]; string [] dishmegs=new string [5]; int [] dishnums=new int [5]; int [] times=new int [5]; string [] addresses=new string [5]; int [] states=new int [5]; double [] sumprices=new double [5];
names [0]=" "; dishmegs [0]=" "; dishnums [0]=2; times [0]=12; addresses [0]=" "; states [0]=0; sumprices [0]=70.0;
system.out.println ("Welcome to the" IIUM FOOD DELIVERY ""); int num=1; boolean isexit=false;
do { system.out.println ("************************"); system.out.println ("1, I want to order"); system.out.println ("2, View meal bag"); system.out.println ("3. Confirmed order"); system.out.println ("4, Delete order"); system.out.println ("6. Exit the system"); system.out.println ("************************"); system.out.print ("Please select:"); num=input.nextint ();
switch (num) { case 1: system.out.println ("*** I want to order a meal ***"); boolean isadd=false; for (int i=0;i
system.out.println ("Order successfully!"); system.out.println ("What you set is:" + dishnames [choosedish-1] + number + "share"); system.out.println ("Meal delivery time:" + time + "point"); double sumprice=prices [choosedish-1] * number; double sendmoney=(sumprice>= 50)?0:5; system.out.println ("Meals:" + sumprice + "Ringgit," + "Meals delivery" + sendmoney + "Ringgit," + "Total:" + (sumprice + sendmoney) + "Ringgit."); names [i]=name; dishmegs [i]=dishmeg; times [i]=time; dishnums [i]=number; addresses [i]=address; sumprices [i]=sumprice + sendmoney; break; } if (isadd) { system.out.println ("Sorry, your bag is full!"); } } break; case 2: system.out.println ("*** View meal bag ***"); system.out.println ("serial number \ t orderer \ tmeal name \ tmeal number \ tmeal delivery time \ tmeal delivery address \ ttotal amount \ torder status"); for (int i=0;i if (names [i]!=null&&states [i] == 1&&delid == i + 1) { isdelfind=true; for (int j=delid-1;j names [names.length-1]=null; dishmegs [names.length-1]=null; dishnums [names.length-1]=0; times [names.length-1]=0; addresses [names.length-1]=null; states [names.length-1]=0; sumprices [names.length-1]=0; system.out.println ("Delete order successfully!"); break; } else if (names [i]!=null&&states [i] == 0&&delid == i + 1) { isdelfind=true; system.out.println ("The order you selected is not signed,Cannot be deleted! "); break; } } if (! isdelfind) { system.out.println ("The order i want to delete does not exist!"); } break; case 5: system.out.println ("*** I want to like it ***"); system.out.println ("serial number \ tname \ tunit price"); for (int i=0;i */need to solve the errors/*
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