Q1.(5pts) Why is it necessary to use type-wrapper class?


Q2.(5pts) thread is a Thread. Write some codes so that thread stops for about 3 seconds.
Q3.(5pts) Write a method
boolean checkPassword(JPasswordField field, String password) returns true if the text in the field is same as password.
Hint You may like to use constructor String(char[]).

Q4.(25 pts) Write a class RadioButtonTest. In below is the screen shots of the program.
Here is part of the code
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class RadioButtonTest extends JFrame                                 {
    private String[] names = {"Dialog", "Serif", "DialogInput","Impact","Comic Sans MS"};
    // other variables
   
    
    public RadioButtonTest() {

    }
    

    
    public static void main(String[] args) {
        JFrame f = new RadioButtonTest();
	f.pack();
	f.setVisible(true);
	f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}

Q5.(25pts) Write a program shows up a JFrame. Such that
Here is part of the code.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Spot extends JFrame {
    private int radius = 10;
    
 
    public static void main(String[] args) {
        JFrame f = new Spot();
	f.setSize(200,200);
	f.setResizable(false);
	f.setVisible(true);
	f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}

Q6.(35pts) Write a class Average. The program let the user input double in a text field. store the double in a vector. The user can find out the average of all the doubles or print out all the doubles in the list. Here is part of the code
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;

public class Average extends JFrame                              {
    JLabel label = new JLabel("Enter a number :");
    JTextField textField = new JTextField(20);
    JLabel display = new JLabel();
    JButton averageButton = new JButton("Average");
    JButton showAllButton = new JButton("Show all");
    JButton clearButton = new JButton("Clear");
    JPanel buttonPanel = new JPanel(new GridLayout(1,0));
    Vector v = new Vector();
    
    public Average() {
	getContentPane().setLayout(new GridLayout(2,2));
	getContentPane().add(label);
	getContentPane().add(textField);
	getContentPane().add(buttonPanel);
	getContentPane().add(display);
	buttonPanel.add(averageButton);
	buttonPanel.add(showAllButton);
	buttonPanel.add(clearButton);
	
    }
 
    
   public static void main(String[] args) {
        JFrame f = new Average();
	f.pack();
	f.setVisible(true);
	f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}