//creating arrays public static String[] name = new String[10]; public static int[] age = new int[10]; public static String[] gender = new String[10]; public static String[] clas = new String[10];...

1 answer below »
Hi, I wrote codes and now I need: Algorithm, Flowchart, Commented code, test cases, data dictionary


//creating arrays      public static String[] name = new String[10];      public static int[] age = new int[10];      public static String[] gender = new String[10];      public static String[] clas = new String[10];      public static int[] beginner = new int[10];      public static int[] points1 = new int[10];      public static int[] points2 = new int[10];      public static int[] points3 = new int[10];      public static String[] score = new String[10];      public static int[] total = new int[10];            public static void main(String[] args) {             input();          output();      }      public static void input() {          //creating loop to ask 10 times          for (int i = 0; i < 10;="" i++)="" { =""             //asking="" user="" to="" enter="" all="" details  =""             name[i]="getString("Enter" your="" name:"); =""             age[i]="getInt("Enter" your="" age="" :"); =""             gender[i]="getString("Enter" your="" gender:"); =""             clas[i]="getString("Enter" class:"); =""             //asking="" user="" to="" enter="" 1="" or="" 2="" for="" yes/no  =""             beginner[i]="getInt("Are" you="" a="" beginner="" :="" \n1="Yes\n2=No"); "             points1[i]="getInt("Enter" amount="" of="" points="" earned="" in="" competition="" 1:="" halloween="" horrors:"); =""             points2[i]="getInt("Enter" amount="" of="" points="" earned="" in="" competition="" 2:="" christmas="" crackers:"); =""             points3[i]="getInt("Enter" amount="" of="" points="" earned="" in="" competition="" 3:="" easter="" bunnies:"); =""            //adding="" up="" total="" number="" of="" points="" earned =""             total[i]="(points1[i]" +="" points2[i]="" +="" points3[i]); =""              =""             //using="" if="" statements="" to="" determine="" level =""             if="" (total[i]="">= 24) {                  score[i] = " Pro";              } else if (total[i] >= 16) {                  score[i] = "n Average";              } else if (total[i] >= 8) {                  score[i] = " Below Average";              } else {                  score[i] = " Bad";              }              //if statement to determine if extra beginner points are to be awarded              if (beginner[i] == 1) {                  total[i] = total[i] + 6;              } else {              }          }      }      //show message with all details      public static void output() {          for (int i = 0; i < 10;="" i++)="" { =""             joptionpane.showmessagedialog(null,="" "name:="" "="" +="" name[i] =""                     +="" "\n"="" +="" "age:="" "="" +="" age[i] =""                     +="" "\n"="" +="" "gender:="" "="" +="" gender[i] =""                     +="" "\n"="" +="" "class:="" "="" +="" clas[i] =""                     +="" "\n"="" +="" "beginner:="" "="" +="" beginner[i] =""                     +="" "\n"="" +="" "you="" got="" "="" +="" total[i]="" +="" "="" points" =""                     +="" "\nyou="" are="" a"="" +="" score[i]="" +="" "="" gamer"); =""         } =""     } =""     //get="" string="" method =""     public="" static="" string="" getstring(string="" usermsg)="" { =""         string="" input="JOptionPane.showInputDialog(userMsg); "         return="" input; =""     } =""     //get="" int="" method =""     public="" static="" int="" getint(string="" usermsg)="" { =""         int="" num="Integer.parseInt(JOptionPane.showInputDialog(userMsg)); "         return="" num; =""     } ="" } ="" package="" why.why;="" import="" javax.swing.joptionpane;="" **="" *="" *="" @author="" majak="" */="" public="" class="" whywhy="" {="" **="" *="" @param="" args="" the="" command="" line="" arguments="" */="" public="" static="" void="" main(string[]="" args)="" {="" int="" monticket="25;" int="" tueticket="30;" int="" wedticket="40;" int="" thuticket="45;" int="" friticket="35;" int="" satticket="30;" int="" sixdayticket="150;" double="" monticketfee="0.07;" double="" tueticketfee="0.05;" double="" wedticketfee="0.03;" double="" thuticketfee="0.035;" double="" friticketfee="0.025;" double="" satticketfee="0.025;" double="" sixdayticketfee="0.04;" int="" ticketchoice="0;" int="" numoftickets="0;" int="" montickets="0;" int="" tustickets="0;" int="" wedtickets="0;" int="" thutickets="0;" int="" fritickets="0;" int="" sattickets="0;" int="" sixdaystickets="0;" int="" totalticketssold="0;" double="" monprofit=".1;" double="" tusprofit=".15;" double="" wedprofit=".20;" double="" otherprofit="0.25;" double="" totalprofit="0;" double="" totalmoney="0;" int="" i="0;" for(i=""><2;i++){ ticketchoice = integer.parseint(joptionpane.showinputdialog ("please select your choice: " + "\n1 for monday ticket" + "\n2 for tuesday ticket 25e" + "\n3 for wednsday ticket 30e" + "\n4 for thursdya ticket 40e" + "\n5 for friday ticket 45" + "\n6 for saturday ticket 35 " + "\nor 7 for six day ticket 150e" + "\n ")); if(ticketchoice==1){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*monticket; double bookingfee = cost * monticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * tusprofit); totalmoney += amountpayable; montickets += numoftickets; joptionpane.showmessagedialog(null, "thanks for purchasing " + numoftickets + " monday tickets" + "\nplease pay: " + amountpayable); } else if(ticketchoice==2){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*tueticket; double bookingfee = cost * tueticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * monprofit); totalmoney += amountpayable; tustickets += numoftickets; joptionpane.showmessagedialog(null, "thanks for purchasing " + numoftickets + " tuesday tickets" + "\nplease pay: " + amountpayable); } else if(ticketchoice==3){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*wedticket; double bookingfee = cost * wedticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * wedprofit); wedtickets += numoftickets; totalmoney += amountpayable; joptionpane.showmessagedialog(null, "thanks for purchasing " + numoftickets + " wednesday tickets" + "\nplease pay: " + amountpayable); } else if(ticketchoice==4){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*thuticket; double bookingfee = cost * thuticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * otherprofit); thutickets += numoftickets; totalmoney += amountpayable; joptionpane.showmessagedialog(null, "thanks for purchasing " + numoftickets + " thursday tickets" + "\nplease pay: " + amountpayable); } else if(ticketchoice==5){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*friticket; double bookingfee = cost * friticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * otherprofit); fritickets += numoftickets; joptionpane.showmessagedialog(null, "thanks for purchasing " + numoftickets + " friday tickets" + "\nplease pay: " + amountpayable); } else if(ticketchoice==6){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*satticket; double bookingfee = cost * satticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * otherprofit); sattickets += numoftickets; totalmoney += amountpayable; joptionpane.showmessagedialog(null, "thanks for purchasing " + numoftickets + " saturday tickets" + "\nplease pay: " + amountpayable); } else if(ticketchoice==7){ numoftickets = integer.parseint(joptionpane.showinputdialog ("how many tickets would you like to purchase")); double cost = numoftickets*sixdayticket; double bookingfee = cost * sixdayticketfee; double amountpayable = cost + bookingfee; totalprofit = totalprofit + (cost * otherprofit); sixdaystickets += numoftickets; totalmoney += amountpayable; joptionpane.showmessagedialog(null ticketchoice="Integer.parseInt(JOptionPane.showInputDialog" ("please="" select="" your="" choice:="" "="" +="" "\n1="" for="" monday="" ticket"="" +="" "\n2="" for="" tuesday="" ticket="" 25e"="" +="" "\n3="" for="" wednsday="" ticket="" 30e"="" +="" "\n4="" for="" thursdya="" ticket="" 40e"="" +="" "\n5="" for="" friday="" ticket="" 45"="" +="" "\n6="" for="" saturday="" ticket="" 35="" "="" +="" "\nor="" 7="" for="" six="" day="" ticket="" 150e"="" +="" "\n="" "));="" if(ticketchoice="=1){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*monTicket;" double="" bookingfee="cost" *="" monticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" tusprofit);="" totalmoney="" +="amountPayable;" montickets="" +="numOfTickets;" joptionpane.showmessagedialog(null,="" "thanks="" for="" purchasing="" "="" +="" numoftickets="" +="" "="" monday="" tickets"="" +="" "\nplease="" pay:="" "="" +="" amountpayable);="" }="" else="" if(ticketchoice="=2){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*tueTicket;" double="" bookingfee="cost" *="" tueticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" monprofit);="" totalmoney="" +="amountPayable;" tustickets="" +="numOfTickets;" joptionpane.showmessagedialog(null,="" "thanks="" for="" purchasing="" "="" +="" numoftickets="" +="" "="" tuesday="" tickets"="" +="" "\nplease="" pay:="" "="" +="" amountpayable);="" }="" else="" if(ticketchoice="=3){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*wedTicket;" double="" bookingfee="cost" *="" wedticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" wedprofit);="" wedtickets="" +="numOfTickets;" totalmoney="" +="amountPayable;" joptionpane.showmessagedialog(null,="" "thanks="" for="" purchasing="" "="" +="" numoftickets="" +="" "="" wednesday="" tickets"="" +="" "\nplease="" pay:="" "="" +="" amountpayable);="" }="" else="" if(ticketchoice="=4){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*thuTicket;" double="" bookingfee="cost" *="" thuticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" otherprofit);="" thutickets="" +="numOfTickets;" totalmoney="" +="amountPayable;" joptionpane.showmessagedialog(null,="" "thanks="" for="" purchasing="" "="" +="" numoftickets="" +="" "="" thursday="" tickets"="" +="" "\nplease="" pay:="" "="" +="" amountpayable);="" }="" else="" if(ticketchoice="=5){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*friTicket;" double="" bookingfee="cost" *="" friticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" otherprofit);="" fritickets="" +="numOfTickets;" joptionpane.showmessagedialog(null,="" "thanks="" for="" purchasing="" "="" +="" numoftickets="" +="" "="" friday="" tickets"="" +="" "\nplease="" pay:="" "="" +="" amountpayable);="" }="" else="" if(ticketchoice="=6){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*satTicket;" double="" bookingfee="cost" *="" satticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" otherprofit);="" sattickets="" +="numOfTickets;" totalmoney="" +="amountPayable;" joptionpane.showmessagedialog(null,="" "thanks="" for="" purchasing="" "="" +="" numoftickets="" +="" "="" saturday="" tickets"="" +="" "\nplease="" pay:="" "="" +="" amountpayable);="" }="" else="" if(ticketchoice="=7){" numoftickets="Integer.parseInt(JOptionPane.showInputDialog" ("how="" many="" tickets="" would="" you="" like="" to="" purchase"));="" double="" cost="numOfTickets*sixDayTicket;" double="" bookingfee="cost" *="" sixdayticketfee;="" double="" amountpayable="cost" +="" bookingfee;="" totalprofit="totalProfit" +="" (cost="" *="" otherprofit);="" sixdaystickets="" +="numOfTickets;" totalmoney="" +="amountPayable;">
Answered 1 days AfterJan 31, 2022

Answer To: //creating arrays public static String[] name = new String[10]; public static int[] age = new...

Neha answered on Feb 01 2022
114 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here