100%(1)Il 100% ha trovato utile questo documento (1 voto)
106 visualizzazioni41 pagine
This document discusses machine problems in Java compilation for a class. It includes 4 problems with codes and outputs:
1. Displaying information by inputting and outputting personal details.
2. Displaying information using JOptionPane instead of just System.out.
3. Grade computation that calculates a final grade based on test scores and outputs the grade and rating.
4. An enrollment system that allows choosing a course and displays the tuition fee based on the year level.
This document discusses machine problems in Java compilation for a class. It includes 4 problems with codes and outputs:
1. Displaying information by inputting and outputting personal details.
2. Displaying information using JOptionPane instead of just System.out.
3. Grade computation that calculates a final grade based on test scores and outputs the grade and rating.
4. An enrollment system that allows choosing a course and displays the tuition fee based on the year level.
This document discusses machine problems in Java compilation for a class. It includes 4 problems with codes and outputs:
1. Displaying information by inputting and outputting personal details.
2. Displaying information using JOptionPane instead of just System.out.
3. Grade computation that calculates a final grade based on test scores and outputs the grade and rating.
4. An enrollment system that allows choosing a course and displays the tuition fee based on the year level.
23 Km Sumulong Highway Brgy. Sta Cruz Antipolo City College of Computer Studies
Submitted to: Mr. Jayson G. Mauricio
Submitted By: Evarola, Arrah Cristelle T. BSIT 2Y2-1
MACHINE PROBLEMS IN JAVA COMPILATION Prelim: Machine Problem No.1 Displaying Information Codes: import java.io.*; import javax.swing.JOptionPane;
public class Prelim_MP1{ public static void main(String []args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("\n\t\tOur Lady Of Fatima University"); System.out.print("\n\t\t\t Antipolo City"); System.out.print("\n\t\t COLLEGE OF COMPUTER STUDIES");
System.out.print("\n\t ----------------------------------------"); System.out.print("\n\nEnter your name: "); name = br.readLine(); System.out.print("Enter your age: "); age = br.readLine(); System.out.print("Enter your birthday: "); birthday = br.readLine(); System.out.print("Enter your address: "); address = br.readLine(); System.out.print("Enter your school: "); school = br.readLine(); System.out.print("Enter your mother's name: "); mother = br.readLine(); System.out.print("Enter your father's name: "); father = br.readLine();
System.out.print("\n\n\tMy Name is " + name + ". I am " + age + " years old and my birthday is on " + birthday + ". I lived in " + address + " and studying at " + school + ". My parents's are " + father + " and " + mother +".\n\n"); } }
MACHINE PROBLEMS IN JAVA COMPILATION Prelim: Machine Problem No.1 Displaying Information Output:
MACHINE PROBLEMS IN JAVA COMPILATION Prelim: Machine Problem No.2 Displaying with JOptionPane Codes: import java.io.*; import javax.swing.JOptionPane;
public class Prelim_MP2{ public static void main(String[]args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("\n\t\tOur Lady Of Fatima University"); System.out.print("\n\t\t\t Antipolo City"); System.out.print("\n\t\t COLLEGE OF COMPUTER STUDIES");
System.out.print("\n"); System.out.print("\n"); System.out.print("\n\tName: "); name=br.readLine(); System.out.print("\tAge: "); age=br.readLine(); System.out.print("\tBirthday: "); bday=br.readLine(); System.out.print("\tAddress: "); address=br.readLine(); System.out.print("\tSchool: "); school=br.readLine(); System.out.print("\tName of your Father: "); fder=br.readLine(); System.out.print("\tName of your Mother: "); mder=br.readLine();
JOptionPane.showMessageDialog(null, "\t Ako si " +name + ", " + " " + age + " taong gulang.\n" + " Ipinanganak ako noong " + bday + ".\n" + "Nakatira ako sa " + address + ".\n\n" + "\t Ako ay nag-aaral sa " + school + ".\n" + "Ang magulang ko ay sina " + fder + "\nat " + mder + "."); } } MACHINE PROBLEMS IN JAVA COMPILATION Prelim: Machine Problem No.2 Displaying with JOptionPane Output:
if (year_level==1){ System.out.print("\n\tFIRST YEAR! - "); switch(course2){ case 'a': case 'A': System.out.print("BS Information Technology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(it1)); break; case 'b': case 'B': System.out.print("BS Hotel and Restaurant Mngt"); System.out.print("\n\n\tTUITION FEE: "+format1.format(hrm1)); break; case 'c': case 'C': System.out.print("BS Nursing"); System.out.print("\n\n\tTUITION FEE: "+format1.format(bsn1)); break; case 'd': case 'D': System.out.print("BS BusinesseAd"); System.out.print("\n\n\tTUITION FEE: "+format1.format(ba1)); break; case 'e': case 'E': System.out.print("BS Med. Tech."); System.out.print("\n\n\tTUITION FEE: "+format1.format(medtech1)); break; case 'f': case 'F': System.out.print("BS Psychology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(psych1)); break; case 'g': case 'G': System.out.print("BSPH"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pharma1)); break; case 'h': case 'H': System.out.print("BSPT"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pt1)); break; default: System.out.println("invalid input"); } }
else if (year_level==2){ System.out.print("\n\tSECOND YEAR! - "); switch(course2){ case 'a': MACHINE PROBLEMS IN JAVA COMPILATION case 'A': System.out.print("BS Information Technology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(it2)); break; case 'b': case 'B': System.out.print("BS Hotel and Restaurant Mngt"); System.out.print("\n\n\tTUITION FEE: "+format1.format(hrm2)); break; case 'c': case 'C': System.out.print("BS Nursing"); System.out.print("\n\n\tTUITION FEE: "+format1.format(bsn2)); break; case 'd': case 'D': System.out.print("BS BusinesseAd"); System.out.print("\n\n\tTUITION FEE: "+format1.format(ba2)); break; case 'e': case 'E': System.out.print("BS Med. Tech."); System.out.print("\n\n\tTUITION FEE: "+format1.format(medtech2)); break; case 'f': case 'F': System.out.print("BS Psychology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(psych2)); break; case 'g': case 'G': System.out.print("BSPH"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pharma2)); break; case 'h': case 'H': System.out.print("BSPT"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pt2)); break; default: System.out.println("invalid input"); } } else if (year_level==3){ System.out.print("\n\tTHIRD YEAR! - "); switch(course2){ case 'a': case 'A': System.out.print("BS Information Technology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(it3)); break; case 'b': case 'B': System.out.print("BS Hotel and Restaurant Mngt"); System.out.print("\n\n\tTUITION FEE: "+format1.format(hrm2)); break; case 'c': case 'C': System.out.print("BS Nursing"); System.out.print("\n\n\tTUITION FEE: "+format1.format(bsn3)); break; case 'd': case 'D': System.out.print("BS BusinesseAd"); System.out.print("\n\n\tTUITION FEE: "+format1.format(ba2)); break; case 'e': case 'E': System.out.print("BS Med. Tech."); System.out.print("\n\n\tTUITION FEE: "+format1.format(medtech3)); break; case 'f': case 'F': System.out.print("BS Psychology"); MACHINE PROBLEMS IN JAVA COMPILATION System.out.print("\n\n\tTUITION FEE: "+format1.format(psych2)); break; case 'g': case 'G': System.out.print("BSPH"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pharma3)); break; case 'h': case 'H': System.out.print("BSPT"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pt2)); break; default: System.out.println("invalid input"); } }
else if (year_level==4){ System.out.print("\n\tFOURTH YEAR! - "); switch(course2){ case 'a': case 'A': System.out.print("BS Information Technology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(it4)); break; case 'b': case 'B': System.out.print("BS Hotel and Restaurant Mngt"); System.out.print("\n\n\tTUITION FEE: "+format1.format(hrm4)); break; case 'c': case 'C': System.out.print("BS Nursing"); System.out.print("\n\n\tTUITION FEE: "+format1.format(bsn4)); break; case 'd': case 'D': System.out.print("BS BusinesseAd"); System.out.print("\n\n\tTUITION FEE: "+format1.format(ba4)); break; case 'e': case 'E': System.out.print("BS Med. Tech."); System.out.print("\n\n\tTUITION FEE: "+format1.format(medtech4)); break; case 'f': case 'F': System.out.print("BS Psychology"); System.out.print("\n\n\tTUITION FEE: "+format1.format(psych4)); break; case 'g': case 'G': System.out.print("BSPH"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pharma4)); break; case 'h': case 'H': System.out.print("BSPT"); System.out.print("\n\n\tTUITION FEE: "+format1.format(pt4)); break; default: System.out.println("invalid input"); } } else{ System.out.print("\n\tINVALID!!"); } answer = JOptionPane.showInputDialog(null,"Do youwant to try again?[yes/no]:"); } while(answer.equalsIgnoreCase("YES")); } }
MACHINE PROBLEMS IN JAVA COMPILATION Prelim: Machine Problem No.4 Enrollment System Output:
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.1 Quiz Array Codes: import java.io.*; import javax.swing.JOptionPane; import java.io.IOException; import java.io.BufferedReader;
public class Midterm_MP1{ public static void main(String args[])throws IOException{ String [][] q; q = new String[10][5]; int score=0; //#1 q[0][0]="One of the first projects developed using Java was.."; q[0][1]="[A] Java"; q[0][2]="[B] Star 7"; q[0][3]="[C] Oak"; q[0][4]="B"; //#2 q[1][0]="Who created Java?"; q[1][1]="[A] James Gosling"; q[1][2]="[B] Dennis Richie"; q[1][3]="[C] Sun Micro Systems"; q[1][4]="A"; //#3 q[2][0]=" Java was created in.."; q[2][1]="[A] 1990"; q[2][2]="[B] 1901"; q[2][3]="[C] 1992"; q[2][4]="B"; //#4 q[3][0]="It was the first name of Java but soon changed because there was already a language called.."; q[3][1]="[A] Oak"; q[3][2]="[B] JRE"; q[3][3]="[C] Java Mobile"; q[3][4]="A"; //#5 q[4][0]="Java can create all kinds of applications that you could create using any conventional programming language ."; q[4][1]="[A] True"; q[4][2]="[B] False"; q[4][3]="[C] I dont know."; q[4][4]="A"; MACHINE PROBLEMS IN JAVA COMPILATION //#6 q[5][0]="It is a list of data items that all have the same type and the same name."; q[5][1]="[A] Integer"; q[5][2]="[B] Variable"; q[5][3]="[C] Array"; q[5][4]="C"; //#7 q[6][0]="Variables containing an adress to an object in memory."; q[6][1]="[A] Object"; q[6][2]="[B] Object Variable"; q[6][3]="[C] Object Reference Variable"; q[6][4]="C"; //#8 q[7][0]=" Meaning of AWT."; q[7][1]="[A] Abstract Window Toolkit"; q[7][2]="[B] Abstract Windowing Toolkit"; q[7][3]="[C] Actual Window Toolkit"; q[7][4]="B"; //#9 q[8][0]="Package in AWT that is used to handle events generated by the AWT components ."; q[8][1]="[A] java.awt.events"; q[8][2]="[B] java.awt.event_action"; q[8][3]="[C] java.awt.event"; q[8][4]="C"; //#10 q[9][0]="Most frequently used container class."; q[9][1]="[A] Container"; q[9][2]="[B] Panel"; q[9][3]="[C] Components"; q[9][4]="B";
BufferedReader x = new BufferedReader(new InputStreamReader(System.in)); String answer = new String(); System.out.println(); System.out.println("CS315 Java Test"); System.out.println(); for (int i=0; i<10; ++i){ System.out.print((i+1)+".) "); answer = JOptionPane.showInputDialog(null,q[i][0] +"\n"+ q[i][1] +"\n"+q[i][2] +"\n"+q[i][3] +"\n"+"\nAnswer: "); if (answer.equalsIgnoreCase(q[i][4])){ System.out.println("You are Correct!"); score+=1; } else System.out.println("Wrong! The correct answer is : " + q[i][4]); System.out.println(); } System.out.println(); System.out.println("Your Score is: "+score+" point/s"); } } MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.1 Quiz Array Output:
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.2 Vowels and Consonants Codes: import java.io.*; public class Midterm_MP2{ public static void main(String args[])throws IOException{ String[] names; int count[]; names = new String[5]; count = new int[5];
for (int i=0; i<count.length; ++i) count[i]=0;
BufferedReader x = new BufferedReader(new InputStreamReader(System.in)); System.out.print(\n); for(int i=0; i<names.length; ++i) { System.out.print("Enter Name for No."+(i+1)+": "); names[i] = x.readLine(); names[i]= names[i].toUpperCase(); }
for (int i=0; i<names.length; ++i) { for (int j=0; j<names[i].length(); ++j) { char r = names[i].charAt(j); switch (r) { case 'A': count[i]=count[i]+1;break; case 'E': count[i]=count[i]+1;break; case 'I': count[i]=count[i]+1;break; case 'O': count[i]=count[i]+1;break; case 'U': count[i]=count[i]+1;break; default : break; } } } System.out.println("\n"); for (int i=0; i<names.length; ++i) System.out.println("Number of Vowels of " + names[i] + " is : " + count[i]); } } MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.2 Vowels and Consonants Output:
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.3 Jack n Poy Codes: import java.io.*; import java.util.*; import java.io.InputStreamReader; import javax.swing.JOptionPane;
public class Midterm_MP3{ public static void main (String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double num = 0; int point1 = 0; int point2 = 0; JOptionPane.showMessageDialog(null," WELCOME TO jack n' Poy!!\n "+args[0]+" and "+args[1]); System.out.println("\nChoices:\n\t 0 - ROCK\n\t 1 - PAPER\n\t 2 - SCISSORS\n"); Random y = new Random(); for (int i = 1; i<=3 ; i++){ JOptionPane.showMessageDialog(null," ROUND"+ i ); System.out.print(args[0]+" : "); num = Double.parseDouble(br.readLine()); float x = y.nextFloat(); int m = Math.round(2*x); System.out.println(" "+ args[1] +" - " + m+ "\n"); System.out.println(" 0 - ROCK\n 1 - PAPER\n 2 - SCISSORS\n");
if ((num==0) && (m==1)) { point2+=1; JOptionPane.showMessageDialog(null,""+args[1]+" WIN"); }
if (point1>point2){ JOptionPane.showMessageDialog(null," YOU WIN \n SCORE \n "+args[0]+" - "+ point1 + "\n "+args[1]+" - "+ point2 ); JOptionPane.showMessageDialog(null," YOU WIN \n GAME OVER" ); } else if (point1<point2) { JOptionPane.showMessageDialog(null," YOU LOSE \n SCORE \n "+args[0]+" - "+ point1 + "\n "+args[1]+" - "+ point2 ); JOptionPane.showMessageDialog(null," YOU LOSE \n GAME OVER" ); } else { JOptionPane.showMessageDialog(null," DRAW \n SCORE \n "+args[0]+" - "+ point1 + "\n "+args[1]+" - "+ point2 ); JOptionPane.showMessageDialog(null," YOU LOSE \n GAME OVER" ); } } static int min(int x, int y){ if(x<y) return(x); else return(y); } }
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.3 Jack n Poy Output:
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.4 Elevator Codes: Midterm_MP4a.java
import java.io.*; public class Midterm_MP4a { public static void main(String args[]) throws IOException { BufferedReader x = new BufferedReader(new InputStreamReader(System.in)); Midterm_MP4b myElevator = new Midterm_MP4b();
String COMMAND = ""; int goFloor = 0; int LOOP = 0;
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.4 Elevator Codes: Midterm_MP4b.java
import java.io.*; public class Midterm_MP4b { public boolean powerOn = false; public boolean doorOpen = false; public int currentFloor = 1; public int TOP_FLOOR = 6; public int MIN_FLOOR = 1;
public void powerOn() { if(powerOn == true){ System.out.println("Power is already turned off."); } else{ System.out.println("Turning on the power, please wait"); powerOn = true; System.out.println("Power is now turned on, Welcome"); System.out.println("Floor : " + currentFloor); } } public void powerOff() { System.out.println("Turning off the power, please wait"); powerOn = false; System.out.println("Power is now turned off. Goodbye"); } public void doorOpen() { if(powerOn == true){ if(doorOpen == false){ doorOpen = true; System.out.println("Door is now opened"); System.out.println("Floor : " + currentFloor); } else{ System.out.println("Door is already opened"); System.out.println("Floor : " + currentFloor); } } else{ System.out.println("Please turn on the power first"); } } public void doorClose() { if(powerOn == true){ if(doorOpen == true){ doorOpen = false; System.out.println("\nDoor is now closed"); System.out.println("Floor : " + currentFloor); } else{ System.out.println("Door is already closed.."); MACHINE PROBLEMS IN JAVA COMPILATION System.out.println("Floor : " + currentFloor); } } else{ System.out.println("\nPlease turn on the power first."); } } public void goUp() { if(powerOn == true){ if(doorOpen == false){ if(currentFloor > TOP_FLOOR){ System.out.println("INVALID FLOOR, PLEASE CHOOSE FROM 1/G - 6");} else{ currentFloor++; System.out.println("\nGoing up one floor"); System.out.println("Floor : " + currentFloor); } } else{ System.out.println("\nPlease close the door first"); System.out.println("Floor : " + currentFloor); } } else{ System.out.println("\nPlease turn on the power first"); System.out.println("Floor : " + currentFloor); } } public void goDown() { if(powerOn == true){ if(doorOpen == false){ if(currentFloor > TOP_FLOOR){ System.out.println("INVALID FLOOR, PLEASE CHOOSE FROM 1/G - 6"); } else{ currentFloor--; System.out.println("\nGoing down one floor"); System.out.println("Floor : " + currentFloor); } } else{ System.out.println("\nPlease close the door first"); System.out.println("Floor : " + currentFloor); } } else{ System.out.println("\nPlease turn on the power first"); System.out.println("Floor : " + currentFloor); } } }
MACHINE PROBLEMS IN JAVA COMPILATION Midterm: Machine Problem No.4 Elevator Output:
MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.2 Frame Codes: import java.awt.*; import java.io.*;
class Finals_MP2{ public static void main(String args[]) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String title = ""; int x,y,w,h = 0; String color = "";
String ans = ""; String set="";
do{ System.out.print("\nEnter title: "); title = br.readLine(); System.out.print("Enter x axis: "); x =Integer.parseInt(br.readLine()); System.out.print("Enter y axis: "); y =Integer.parseInt(br.readLine()); System.out.print("Enter width: "); w = Integer.parseInt(br.readLine()); System.out.print("Enter height: "); h =Integer.parseInt(br.readLine()); System.out.print("Enter color [R|r - Red / b|B - Blue / p|P - Pink]: "); MACHINE PROBLEMS IN JAVA COMPILATION color = br.readLine(); System.out.print("Set Resizable? [true/no]: "); set = br.readLine();
char color1=color.charAt(0);
if(set.equalsIgnoreCase("true")){ switch(color1){ case 'R': case 'r': new myframe(title,w,h,x,y,Color.red,true);break;
case 'B': case 'b': new myframe(title,w,h,x,y,Color.blue,true);break;
case 'P': case 'p': new myframe(title,w,h,x,y,Color.pink,true);break;
default: System.out.print("Invalid Input."); } } else{ switch(color1){ case 'R': case 'r': new myframe(title,w,h,x,y,Color.red,false);break;
case 'B': case 'b': new myframe(title,w,h,x,y,Color.blue,false);break;
case 'P': case 'p': new myframe(title,w,h,x,y,Color.pink,false);break;
default: System.out.print("Invalid Input."); } } System.out.print(" Do you want to process again? [yes/no]: ");
MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.2 Frame Output:
MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.4 Calculator Codes: import java.awt.*;
public class Finals_MP4 extends Frame{ Button b1,b2,b3,b4,b5,b6,b7,b8,b9; TextField num1,num2,result; int z = 0; public Finals_MP4(String s){ setLayout(new GridLayout(2,1)); Panel p=new Panel(); p.setLayout(new GridLayout(3,2)); Label l1= new Label("First Number:"); Label l2= new Label("Second Number:"); Label l3= new Label("Result is:"); num1 = new TextField(); num2 = new TextField(); result = new TextField(); p.add(l1); p.add(num1); p.add(l2); p.add(num2); p.add(l3); p.add(result);
Panel q=new Panel(); q.setLayout(new GridLayout(3,6)); b1 = new Button("+"); b2 = new Button("-"); b3 = new Button("*"); b4 = new Button("/"); b5 = new Button("%"); b6 = new Button("Average"); b7 = new Button("Clear"); b8 = new Button("^2"); b9 = new Button("^3"); q.add(b1); q.add(b2); q.add(b3); q.add(b4); q.add(b5); q.add(b6); q.add(b7); MACHINE PROBLEMS IN JAVA COMPILATION q.add(b8); q.add(b9); add(p); add(q); layout(); pack(); show(); } public boolean action(Event e, Object o){ int x = Integer.parseInt(num1.getText()); int y = Integer.parseInt(num2.getText()); if("+".equals(e.arg)){ z=x+y; } else if("-".equals(e.arg)){ z=x-y; } else if("*".equals(e.arg)){ z=x*y; } else if("/".equals(e.arg)){ z=x/y; } else if("%".equals(e.arg)){ z=x%y; } else if("Average".equals(e.arg)){ int z=((x+y)/2); } else if("^2".equals(e.arg)){ z=x*x; int v=y*y; } else if("^3".equals(e.arg)){ int z=(x*x)*(y*y)*3; } else{ num1.setText(""); num2.setText(""); result.setText(""); }
result.setText(z+""); return(super.action(e,e.target)); } public boolean handleEvent(Event evt){ if(evt.id == Event.WINDOW_DESTROY){ hide(); System.exit(0); } return(super.handleEvent(evt)); } public static void main(String[] args){ new Finals_MP4("Event Example 3"); } } MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.3 Calculator Output:
MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.3 Cellphone Interface Codes: import java.awt.*; import java.awt.color.*;
Panel h = new Panel(); buttonSEND = new Button("SEND"); setLayout(new GridLayout(8,0)); setFont(new Font("Times New Roman",Font.BOLD,14)); f.add(buttonSEND); f.add(buttonSEND); add("South",f);
layout(); pack(); show(); } } public static void main(String []args){ new Finals_MP3("Cellphone"); } }
MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.3 Cellphone Interface Output:
MACHINE PROBLEMS IN JAVA COMPILATION Finals: Machine Problem No.5 Reservation System Codes: import java.awt.*; import java.awt.event.*;
MACHINE PROBLEMS IN JAVA COMPILATION des = new Label ("Destination:"); destination = new Choice(); destination.addItem("Hong Kong"); destination.addItem("Singapore"); destination.addItem("Bangkok"); destination.addItem("Vancouver");
type = new Label("Type of Flight: ");
flight = new Choice(); flight.addItem("Business"); flight.addItem("Economy");
add = new Label("Addtional Request");
req = new Choice(); req.addItem("20kgs baggage "); req.addItem("Breakfast meal"); req.addItem("NewsPaper");
label1 = new Label(""); Label Y = new Label(""); Label Z = new Label("");
list1 = new List(0,false);
b4 = new Button("Add Item"); b4.addActionListener(this);
b5 = new Button("Remove Item"); b5.addActionListener(this);
total = new Label ("Total Bill: ");
b2 = new Button("Reset"); b2.addActionListener(this);
price= new Label("");
b1 = new Button("Compute Bill"); b1.addActionListener(this);
empty = new Label("");
b3 = new Button("Exit"); b3.addActionListener(this); MACHINE PROBLEMS IN JAVA COMPILATION