hey...how can i use the dialog box joption for now i just use the normal display when i do the joption there alot of error can anyone help thanks.
package javaapplication1;
import java.util.Scanner;
public class JavaApplication1 {
static int MicrowaveNetPerIntem =638,JuicerNetPerIntem=270,CookerNetPerItem=216,OvenNetPerItem=229;
static Scanner input=new Scanner(System.in);
static int MicrowaveSellingPrice=1338;
static int JuicerSellingPrice=650;
static int CookerSellingPrice=366;
static int OvenSellingPrice=479;
static int selection;
static String Item;
static int max = 0;
static int[] QuantitySoldArry = new int[12];
public static void main(String[] args) {
System.out.println("*************************************\nWelcome to Revenue Calculating Syste.\n*************************************\n\n");
System.out.println("Please Enter the quantity of item sold in each months.\n");
System.out.println("Microwave sold in October: ");
QuantitySoldArry[0]=input.nextInt();
System.out.println("Microwave sold in November: ");
QuantitySoldArry[1]=input.nextInt();
System.out.println("Microwave sold in December: ");
QuantitySoldArry[2]=input.nextInt();
System.out.println("Juicer sold in October: ");
QuantitySoldArry[3]=input.nextInt();
System.out.println("Juicer sold in November: ");
QuantitySoldArry[4]=input.nextInt();
System.out.println("Juicer sold in December: ");
QuantitySoldArry[5]=input.nextInt();
System.out.println("Multipurpose Cooker sold in October: ");
QuantitySoldArry[6]=input.nextInt();
System.out.println("Multipurpose Cooker sold in November: ");
QuantitySoldArry[7]=input.nextInt();
System.out.println("Cooker sold in December: ");
QuantitySoldArry[8]=input.nextInt();
System.out.println("Oven sold in October: ");
QuantitySoldArry[9]=input.nextInt();
System.out.println("Oven sold in November: ");
QuantitySoldArry[10]=input.nextInt();
System.out.println("Oven sold in December: ");
QuantitySoldArry[11]=input.nextInt();
System.out.println("**************************\nSelect a number to display\n************************\n");
System.out.println("1: Gross Income");
System.out.println("2: Net Income");
System.out.println("3: Highest Quantity Sold");
System.out.println("4: Highest Net Income");
System.out.println("0: Exit System");
System.out.print("Enter Your Choose: ");
selection=input.nextInt();
if (selection==1){
MethodGross();
}
if (selection==2){
MethodNet();
}
if (selection==3){
MethodQuantity();
}
if (selection==4){
MethodIncome();
}
if (selection==0){
System.exit(0);
}
}
static void MethodGross(){
int GrossMicroOctober=MicrowaveSellingPrice*QuantitySoldArry[0];
int GrossMicroNovember=MicrowaveSellingPrice*QuantitySoldArry[1];
int GrossMicroDecember=MicrowaveSellingPrice*QuantitySoldArry[2];
int GrossJuicerOctober=JuicerSellingPrice*QuantitySoldArry[3];
int GrossJuicerNovember=JuicerSellingPrice*QuantitySoldArry[4];
int GrossJuicerDecember=JuicerSellingPrice*QuantitySoldArry[5];
int GrossMuliCookerOctober=CookerSellingPrice*QuantitySoldArry[6];
int GrossMuliCookerNovember=CookerSellingPrice*QuantitySoldArry[7];
int GrossMuliCookerDecember=CookerSellingPrice*QuantitySoldArry[8];int GrossOvenOctober=OvenSellingPrice*QuantitySoldArry[6];
int GrossOvenNovember=OvenSellingPrice*QuantitySoldArry[7];
int GrossOvenDecember=OvenSellingPrice*QuantitySoldArry[8];int GrossMicroTotal=GrossMicroOctober+GrossMicroNovember+GrossMicroDecember;
int GrossJuicerTotal=GrossJuicerOctober+GrossJuicerNovember+GrossJuicerDecember;
int GrossMuliCookerTotal=GrossMuliCookerOctober+GrossMuliCookerNovember+GrossMuliCookerDecember;
int GrossOvenTotal=GrossOvenOctober+GrossOvenNovember+GrossOvenDecember;
System.out.println("Microwave Gross Income in October = "+GrossMicroOctober);
System.out.println("Microwave Gross Income in November = "+GrossMicroNovember);
System.out.println("Microwave Gross Income in December = "+GrossMicroDecember);
System.out.println("Microwave Gross Income in 3 months = "+GrossMicroTotal);
System.out.println("");
System.out.println("Juicer Gross Income in October = "+GrossJuicerOctober);
System.out.println("Juicer Gross Income in November = "+GrossJuicerNovember);
System.out.println("Juicer Gross Income in December = "+GrossJuicerDecember);
System.out.println("Juicer Gross Income in 3 months = "+GrossJuicerTotal);
System.out.println("");
System.out.println("Multy Cooker Gross Income in October = "+GrossMuliCookerOctober);
System.out.println("MultyCooker Gross Income in November = "+GrossMuliCookerNovember);
System.out.println("Multy Cooker Gross Income in December = "+GrossMuliCookerDecember);
System.out.println("Multy Cooker Gross Income in 3 months = "+GrossMuliCookerTotal);
System.out.println("");
System.out.println("Oven Gross Income in October = "+GrossOvenOctober);
System.out.println("Oven Gross Income in November = "+GrossOvenNovember);
System.out.println("Oven Gross Income in December = "+GrossOvenDecember);
System.out.println("Oven Gross Income in 3 months = "+GrossOvenTotal);
System.out.println("");
System.out.println("Select a number to display:");
System.out.println("1: Gross Income");
System.out.println("2: Net Income");
System.out.println("3: Highest Quantity Sold");
System.out.println("4: Highest Net Income");
System.out.println("0: Exit System");
System.out.print("Enter Your Choose: ");
selection=input.nextInt();
if (selection==1){
MethodGross();
}
if (selection==2){
MethodNet();
}
if (selection==3){
MethodQuantity();
}
if (selection==4){
MethodIncome();
}
if (selection==0){
System.exit(0);
}
}
static void MethodNet(){
int NetMicroOctober=MicrowaveNetPerIntem*QuantitySoldArry[0];
int NetMicroNovember=MicrowaveNetPerIntem*QuantitySoldArry[1];
int NetMicroDecember=MicrowaveNetPerIntem*QuantitySoldArry[2];
int NetMicroTotal=NetMicroOctober+NetMicroNovember+NetMicroDecember;
int NetJuicerOctober=JuicerNetPerIntem*QuantitySoldArry[3];
int NetJuicerNovember=JuicerNetPerIntem*QuantitySoldArry[4];
int NetJuicerDecember=JuicerNetPerIntem*QuantitySoldArry[5];
int NetJuicerTotal=NetJuicerOctober+NetJuicerNovember+NetJuicerDecember;
int NetMuliCookerOctober=CookerNetPerItem*QuantitySoldArry[6];
int NetMuliCookerNovember=CookerNetPerItem*QuantitySoldArry[7];
int NetMuliCookerDecember=CookerNetPerItem*QuantitySoldArry[8];
int NetMuliCookerTotal=NetMuliCookerOctober+NetMuliCookerNovember+NetMuliCookerDecember;
int NetOvenOctober=OvenNetPerItem*QuantitySoldArry[6];
int NetOvenNovember=OvenNetPerItem*QuantitySoldArry[7];
int NetOvenDecember=OvenNetPerItem*QuantitySoldArry[8];
int NetOvenTotal=NetOvenOctober+NetOvenNovember+NetOvenDecember;
System.out.println("Microwave Net Income in October = "+NetMicroOctober);
System.out.println("Microwave Net Income in November = "+NetMicroNovember);
System.out.println("Microwave Net Income in December = "+NetMicroDecember);
System.out.println("Microwave Net Income in 3 months = "+NetMicroTotal);
System.out.println("");
System.out.println("Juicer Net Income in October = "+NetJuicerOctober);
System.out.println("Juicer Net Income in November = "+NetJuicerNovember);
System.out.println("Juicer Net Income in December = "+NetJuicerDecember);
System.out.println("Juicer Net Income in 3 months = "+NetJuicerTotal);
System.out.println("");
System.out.println("Multy Cooker Net Income in October = "+NetMuliCookerOctober);
System.out.println("MultyCooker Net Income in November = "+NetMuliCookerNovember);
System.out.println("Multy Cooker Net Income in December = "+NetMuliCookerDecember);
System.out.println("Multy Cooker Net Income in 3 months = "+NetMuliCookerTotal);
System.out.println("");
System.out.println("Oven Net Income in October = "+NetOvenOctober);
System.out.println("Oven Net Income in November = "+NetOvenNovember);
System.out.println("Oven Net Income in December = "+NetOvenDecember);
System.out.println("Oven Net Income in 3 months = "+NetOvenTotal);
System.out.println("");
System.out.println("Select a number to display:");
System.out.println("1: Gross Income");
System.out.println("2: Net Income");
System.out.println("3: Highest Quantity Sold");
System.out.println("4: Highest Net Income");
System.out.println("0: Exit System");
System.out.print("Enter Your Choose: ");
selection=input.nextInt();
if (selection==1){
MethodGross();
}
if (selection==2){
MethodNet();
}
if (selection==3){
MethodQuantity();
}
if (selection==4){
MethodIncome();
}
if (selection==0){
System.exit(0);
}
}
static void MethodQuantity(){
int QuantityArray[] = new int[4];
QuantityArray[0]=QuantitySoldArry[0]+QuantitySoldArry[1]+QuantitySoldArry[2];
QuantityArray[1]=QuantitySoldArry[3]+QuantitySoldArry[4]+QuantitySoldArry[5];
QuantityArray[2]=QuantitySoldArry[6]+QuantitySoldArry[7]+QuantitySoldArry[8];
QuantityArray[3]=QuantitySoldArry[9]+QuantitySoldArry[10]+QuantitySoldArry[11];
for (int i = 0; i < QuantityArray.length; i++)
{
if(max < QuantityArray[i])
{
max = QuantityArray[i];
if (i==0 ){
Item="Microwave";
}
if (i==1){
Item="Juicer";
}
if (i==2){
Item="Multipurpose cooker";
}
if (i==3){
Item="Oven";
}
}
}
System.out.println("The highest number of quantiry sold:");
System.out.println("Item: "+Item+" Quantity: "+max);
System.out.println("Select a number to display:");
System.out.println("1: Gross Income");
System.out.println("2: Net Income");
System.out.println("3: Highest Quantity Sold");
System.out.println("4: Highest Net Income");
System.out.println("0: Exit System");
System.out.print("Enter Your Choose: ");
selection=input.nextInt();
if (selection==1){
MethodGross();
}
if (selection==2){
MethodNet();
}
if (selection==3){
MethodQuantity();
}
if (selection==4){
MethodIncome();
}
if (selection==0){
System.exit(0);
}
}
static void MethodIncome(){
int NetMicroOctober=MicrowaveNetPerIntem*QuantitySoldArry[0];
int NetMicroNovember=MicrowaveNetPerIntem*QuantitySoldArry[1];
int NetMicroDecember=MicrowaveNetPerIntem*QuantitySoldArry[2];
int NetMicroTotal=NetMicroOctober+NetMicroNovember+NetMicroDecember;
int NetJuicerOctober=JuicerNetPerIntem*QuantitySoldArry[3];
int NetJuicerNovember=JuicerNetPerIntem*QuantitySoldArry[4];
int NetJuicerDecember=JuicerNetPerIntem*QuantitySoldArry[5];
int NetJuicerTotal=NetJuicerOctober+NetJuicerNovember+NetJuicerDecember;
int NetMuliCookerOctober=CookerNetPerItem*QuantitySoldArry[6];
int NetMuliCookerNovember=CookerNetPerItem*QuantitySoldArry[7];
int NetMuliCookerDecember=CookerNetPerItem*QuantitySoldArry[8];
int NetMuliCookerTotal=NetMuliCookerOctober+NetMuliCookerNovember+NetMuliCookerDecember;
int NetOvenOctober=OvenNetPerItem*QuantitySoldArry[6];
int NetOvenNovember=OvenNetPerItem*QuantitySoldArry[7];
int NetOvenDecember=OvenNetPerItem*QuantitySoldArry[8];
int NetOvenTotal=NetOvenOctober+NetOvenNovember+NetOvenDecember;
int NetArray[] = new int[4];
NetArray[0]=NetMicroTotal;
NetArray[1]=NetJuicerTotal;
NetArray[2]=NetMuliCookerTotal;
NetArray[3]=NetOvenTotal;
for (int i = 0; i < NetArray.length; i++)
{
if(max < NetArray[i])
{
max = NetArray[i];
if (i==0 ){
Item="Microwave";
}
if (i==1){
Item="Juicer";
}
if (i==2){
Item="Multipurpose cooker";
}
if (i==3){
Item="Oven";
}
}
}
System.out.println("The Highest Net Income Of 3 Months:");
System.out.println("Item: "+Item+" Net Income: "+max);
System.out.println("Select a number to display:");
System.out.println("1: Gross Income");
System.out.println("2: Net Income");
System.out.println("3: Highest Quantity Sold");
System.out.println("4: Highest Net Income");
System.out.println("0: Exit System");
System.out.print("Enter Your Choose: ");
selection=input.nextInt();
if (selection==1){
MethodGross();
}
if (selection==2){
MethodNet();
}
if (selection==3){
MethodQuantity();
}
if (selection==4){
MethodIncome();
}
if (selection==0){
System.exit(0);
}
}
}