creating a
aysÂ
    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 Ho
ors:");Â
            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=0;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){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*monTicket;
XXXXXXXXXXdouble bookingFee = cost * monTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * tusProfit);
XXXXXXXXXXtotalMoney += amountPayable;
XXXXXXXXXXmonTickets += numOfTickets;
XXXXXXXXXXJOptionPane.showMessageDialog(null, "Thanks for purchasing " + numOfTickets + " Monday tickets" +
"\nPlease pay: " + amountPayable);
}
else if(ticketChoice==2){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*tueTicket;
XXXXXXXXXXdouble bookingFee = cost * tueTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * monProfit);
XXXXXXXXXXtotalMoney += amountPayable;
XXXXXXXXXXtusTickets += numOfTickets;
XXXXXXXXXXJOptionPane.showMessageDialog(null, "Thanks for purchasing " + numOfTickets + " Tuesday tickets" +
"\nPlease pay: " + amountPayable);
}
else if(ticketChoice==3){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*wedTicket;
XXXXXXXXXXdouble bookingFee = cost * wedTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * wedProfit);
XXXXXXXXXXwedTickets += numOfTickets;
XXXXXXXXXXtotalMoney += amountPayable;
XXXXXXXXXXJOptionPane.showMessageDialog(null, "Thanks for purchasing " + numOfTickets + " Wednesday tickets" +
"\nPlease pay: " + amountPayable);
}
XXXXXXXXXXelse if(ticketChoice==4){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*thuTicket;
XXXXXXXXXXdouble bookingFee = cost * thuTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * otherProfit);
XXXXXXXXXXthuTickets += numOfTickets;
XXXXXXXXXXtotalMoney += amountPayable;
XXXXXXXXXXJOptionPane.showMessageDialog(null, "Thanks for purchasing " + numOfTickets + " Thursday tickets" +
"\nPlease pay: " + amountPayable);
}
else if(ticketChoice==5){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*friTicket;
XXXXXXXXXXdouble bookingFee = cost * friTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * otherProfit);
XXXXXXXXXXfriTickets += numOfTickets;
XXXXXXXXXXJOptionPane.showMessageDialog(null, "Thanks for purchasing " + numOfTickets + " Friday tickets" +
"\nPlease pay: " + amountPayable);
}
else if(ticketChoice==6){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*satTicket;
XXXXXXXXXXdouble bookingFee = cost * satTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * otherProfit);
XXXXXXXXXXsatTickets += numOfTickets;
XXXXXXXXXXtotalMoney += amountPayable;
XXXXXXXXXXJOptionPane.showMessageDialog(null, "Thanks for purchasing " + numOfTickets + " Saturday tickets" +
"\nPlease pay: " + amountPayable);
}
else if(ticketChoice==7){
XXXXXXXXXXnumOfTickets = Integer.parseInt(JOptionPane.showInputDialog ("How many tickets would you like to purchase"));
XXXXXXXXXXdouble cost = numOfTickets*sixDayTicket;
XXXXXXXXXXdouble bookingFee = cost * sixDayTicketFee;
XXXXXXXXXXdouble amountPayable = cost + bookingFee;
XXXXXXXXXXtotalProfit = totalProfit + (cost * otherProfit);
XXXXXXXXXXsixDaysTickets += numOfTickets;
XXXXXXXXXXtotalMoney += amountPayable;
XXXXXXXXXXJOptionPane.showMessageDialog(null