Write a Java program to handle applications for universities admission providing a much better user interface than in the program discussed in the second lecture. This program should work as an applet with the width = 700 pixels and the height = 500 pixels. The applet should run with JDK’s appletviewer. If you use IDE Java environments such as DrJava make sure that at the end your code also works in JDK. If you do not have JDK working on your home PC you can always use the TEL labs PCs.

The tasks of this Java program:
- to enter information for a number of candidates/students,
- to display the information about all the candidates stored
- to display the information for a certain candidate

Your Task
In this assignment class Student encapsulates the student information relevant for universities admission: student name (just the family name), highschool average and 3 universities chosen. The admission is based on the highschool average according to the following table:

University, Highschool average for admission
Toronto 90
York 84
Brock 75
Guelph 76
Waterloo 88
McGill 90
Concordia 76
Laval 78
Macmaster 82
Western 80

Based on this table a method of Student should decide the admission and the method toString() should produce a String as in the following example:
Smith, average=87, York-admitted, McGill-rejected, UofT- rejected
Class ApplicationCentre extends JApplet. At the top of the file introduce as a comment your name and student number. This program was used to introduce the CardLayout management.
The Main Screen has on the left hand side 3 buttons presented in a column. These buttons have the labels: Input, DisplayAll, Search. The user will click on these buttons to change the panels displayed in the right hand side of the screen (using the CardDeck layout manager). The followings are the description of the right panels (the "cards"). Note that you have some flexibility in organizing the layout of each panel.

The Input panel, uses labels to prompt the user and four textfields to enter the student name, the highschool average mark. This panel also contains a JList object containing the following 10 Canadian universities: Toronto, York, Western, Brock, Guelph, Waterloo, McGill, Concordia, Laval and Macmaster. From that list the user will select 3 universities. A Button labeled "Submit" displayed at the bottom of the panel allows the user to enter the input data coming from textfields and JList object into an array with maximum 100 Student objects. Do not forget to erase the content of the textfields when the Submit button is clicked and provide a label which shows how many students were entered (for instance it should say "student 5 out of 100").

The DisplayAll panel will present the content of the array of objects using a JTextArea object. In this textarea the students are displayed with the names in ascending order (you need to sort the array of objects using the Bubble Sort algorithm). The text in the JTextArea is displayed with a Serif style font in Italic and 12-point size.
The Search panel contains at the top the label “Enter student’s name” and next to that label a textfield. Below the panel contains a JTextArea, where the result of the search is displayed with in Arial style font and 14-point size. If the search for the student fails the textarea should contain the message “Student not found”.

You should enter at least 3 candidates into the array of objects. Make sure that the names are not in ascending order and use highschool averages over 75. After you test the two Display panels, enter one more candidate and check the DisplayAll panel again.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

public class ApplicationCentre extends JApplet implements ActionListener {

    // left buttons
    private JButton[] buttons;
    private final String[] buttonNames = {"Input", "DisplayAll", "Search"};

    // right panel
    private JPanel cards;

    // items on the first card
    private JTextField aStudentName;
    private JTextField aStudentAverage;

    private final int jTextFieldColumn = 30;
    private final int jListWidth = 450;

    // show number of student in the array
    private JLabel studentNumLabel;
    private JList<String> universities;
    // array of universities
    public static final String[] universityNames = {
       "Toronto", "York", "Brock", "Guelph", "Waterloo", "McGill",
       "Concordia", "Laval", "Macmaster", "Western"
    private JButton submitButton;

    // items on the second card
    private JTextArea allStudents;

    // items on the third card
    private JTextField searchField;
    private JTextArea searchResult;

    // array of students
    private Student[] students;
    private final int MAX_STUDENT_NUM = 100;
    private int studentNum;...

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats