Question: JAVA Create a GUI for this particular project. You can use the lab 4 solution that youve submitted. Your GUI is completely up to you

JAVA

Create a GUI for this particular project. You can use the lab 4 solution that youve submitted.

Your GUI is completely up to you and should display all information that you find useful. It should be intuitive and informative.

Create a program that keeps track of specific information for Students. The information stored should be the following:

First Name, Last Name, Major, GPA, UIN, NetID, Age, Gender,

For this simple program we will only need to store 10 students in an ArrayList. Your students should be stored in an object called Student.

You should be able to add, display, sort (by any column you chose) and remove Students in the ArrayList.

Hint: To make your life easier take your previous lab solution and add a menu bar instead of adding a lot of new items.

Below is my current code:

Student

==================

public class Student{ public String firstName; public String lastName; String major; double gpa; int uin; int netId; int age; String gender; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getMajor() { return major; } public void setMajor(String major) { this.major = major; } public double getGpa() { return gpa; } public void setGpa(double gpa) { this.gpa = gpa; } public int getUin() { return uin; } public void setUin(int uin) { this.uin = uin; } public int getNetId() { return netId; } public void setNetId(int netId) { this.netId = netId; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String toString(){ String str = "Name: " + lastName + ", " + firstName; str += " Major: " + major; str += " GPA: " + gpa; str += " UIN: " + uin; str += " NetID: " + netId; str += " Age: " + age; str += " Gender: " + gender + " "; return str; } public Student(String firstName, String lastName, String major, double gpa, int uin, int netId, int age, String gender) { this.firstName = firstName; this.lastName = lastName; this.major = major; this.gpa = gpa; this.uin = uin; this.netId = netId; this.age = age; this.gender = gender; } }

LAB 4

================

import java.util.ArrayList; import java.util.Scanner;

public class Lab4{ static void display(ArrayList students){ for(int i = 0; i < students.size(); i++){ System.out.println(students.get(i)); } } static int search(ArrayList students, int uin){ for(int i = 0; i < students.size(); i++){ if(students.get(i).getUin() == uin) return i; } return -1; } public static void main(String args[]){ ArrayList students = new ArrayList(); int choice; Scanner in = new Scanner(System.in); String fn, ln, m, gender; double g; int uin, nid, age; while(true){ System.out.print("1. Add a student 2. Remove a student 3. Print 4. Exit"); choice = in.nextInt(); switch(choice){ case 1: System.out.print("Enter the first name: "); fn = in.nextLine(); System.out.print("Enter the last name: "); ln = in.nextLine(); System.out.print("Enter the major: "); m = in.nextLine(); System.out.print("Enter the GPA: "); g = in.nextInt(); System.out.print("Enter the uin: "); uin = in.nextInt(); System.out.print("Enter the NetID: "); nid = in.nextInt(); System.out.print("Enter the age: "); age = in.nextInt(); System.out.print("Enter the gender: "); gender = in.nextLine(); Student temp = new Student(fn, ln, m, g, uin, nid, age, gender); students.add(temp); break; case 2: System.out.print("Enter the uin to delete: "); uin = in.nextInt(); int index = search(students, uin); students.remove(index); break; case 3: display(students); case 4: return; } } } }

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 Databases Questions!