Question: Instruction:Source.java is required You must run and compile the attachments before attempting the exercises above.Compile and run Appletimport java.awt. * ;import java.applet. * ;import java.awt.event.

Instruction:Source.java is required
You must run and compile the attachments before attempting the exercises above.Compile and run Appletimport java.awt.*;import java.applet.*;import java.awt.event.*;public class prob5 extends Applet implements ActionListener{Label greeting = new Label("Enter Category 1-7");Font IFont = new Font("TimesRoman", Font.ITALIC, 14);Label head1= new Label(" SEAT SECTION ");Label head2= new Label("PRICE PER SEAT");Button submit = new Button("Submit");Button clear = new Button("Clear");TextField category = new TextField("",3);TextField name = new TextField("",15); TextField cost = new TextField("",9);public void init(){greeting.setFont(IFont);add(greeting);add(category);add(submit);add(clear);add(name);add(cost);add(head1);add(head2); category.addActionListener(this);category.requestFocus();submit.addActionListener(this);clear.addActionListener(this);}public void actionPerformed(ActionEvent thisEvent){int temp;String catString = category.getText();try{temp = Integer.parseInt( catString );}catch( NumberFormatException e ){temp =0;}switch(temp){case 1:name.setText("Courtside");cost.setText("35.00");category.requestFocus();break;case 2:name.setText("On The Floor");cost.setText("22.00");category.requestFocus();break;case 3:name.setText("The Perimeter");cost.setText("15.00");category.requestFocus();break;case 4:name.setText("Under The Hoop");cost.setText("13.00");category.requestFocus();break;case 5:name.setText("Above The Rim");cost.setText("12.00");category.requestFocus();break;case 6:name.setText("Full Court");cost.setText("12.00");category.requestFocus();break;case 7:name.setText("High Five");cost.setText("9.00");category.requestFocus();break;default:name.setText("INVALID");cost.setText("0");category.requestFocus();}if(thisEvent.getActionCommand()== "Clear"){category.setText("");name.setText("");cost.setText("");category.requestFocus();}invalidate();validate();}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!