Question: PLESE COMPLETE THE CODE IN JAVA I NEED THIS FAST package uj; //add line for Task 1.1: //------------------------ //add line for Task 1.2: public class

PLESE COMPLETE THE CODE

IN JAVA I NEED THIS FAST

package uj; //add line for Task 1.1: //------------------------ //add line for Task 1.2: public class Student { //fields private String StudentName; private double GPA; private String major; //constructor public Student(String sn,double gpa,String m){ StudentName=sn; GPA=gpa; major=m; } //set methods public void setStudentName(String sn){ StudentName=sn; } public void setGPA(double gpa){ GPA=gpa; } public void setMajor(String m){ major=m; } //get methods public String getStudentName(){ return StudentName; } public double getGPA(){ return GPA; } public String getMajor(){ return major; } }

This UJ program will ask the user for three students names, their major and their GPA. The program will then check the validity of the entered GPA. An exception will be thrown if an invalid GPA is entered using IllegalArgumentException class. After reading the required information, the student should create an object from the Student class and store it in the file as object type. The student needs to handle all the expected exceptions that might occur during the writhing or reading process from the file.

Note: there are specific Files associated with this lab exam.

Before you start do the following to set up you work environment:

Create new project called UJ

Create new class called Student and copy Student.java file

Create new class called UJDemo and copy UJDemo.java file

Task #1 implement the Serializable interface

Task 1.1: add the import of the required classes in order to be able to complete this task

Task1.2: In order to simply save objects to a file, you have to serialize these objects. Therefore, the Student class must implement the Serializable interface.

Student

-StudentName:String

-major:String

-GPA:double

+Student(sn:String, gpa:double,m:String):

+setStudentName(sn:String):void

+setMajor(m:String):void

+setGPA(gpa:double):void

+getStudentName():String

+getMajor():String

+getGPA():double

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!