Question: NEED HELP IN WRITING JAVA CODE: Task 1: Create a Student Class that encapsulates the concept of a student. The attributes of a student are:
NEED HELP IN WRITING JAVA CODE:
Task 1:
Create a Student Class that encapsulates the concept of a student. The attributes of a student are:
id
a random integer in the range 0 to 9999999 (i.e. like an NDSU student ID number)
do NOT allow for duplicate id numbers
lname
a String of a random length between 10 and 15 random characters that represent the students last name
the first character should be an upper-case character
the remaining characters should be lower-case.
The strings do not have to resemble actual names
fname
a String of a random length between 5 and 10 random characters that represent the students first name
the first character should be an upper-case character
the remaining characters should be lower-case.
The strings do not have to resemble actual names
standinga string that represents the class standing of the student. The string must be one of the following (distributed as indicated):
senior 10%
junior 20%
sophomore 30%
freshman 40%
gpaa two decimal place floating point number in the range 0.00 to 4.00 (distributed as indicated):
4.00 5%
3.00 to 3.99 20%
2.00 to 2.99 50%
1.00 to 1.99 20%
0.00 to 0.99 5%
I HAVE LITTLE CODE OR IT, HOPE IT'LL HELP YOU-->
public class Student { int ID; String Lname; String Fname; String Standing; float GPA; Random rand = new Random(); public Student(){ ID = rand.nextInt(100000000); Lname = generateRandomLastName(); Fname = generateRandomFirstName(); Standing = generateRandomStanding(); GPA = generateRandomGPA(); } public Student( int id ,String Lname, String Fname,String Standing, float GPA){ ID = id; this.Lname = Lname; this.Fname = Fname; this.Lname = Lname; this.Standing = Standing; this.GPA = GPA; } public int getID(){ return ID; } public String getLname(){ return Lname; } public String getFname(){ return Fname; } public String getStanding(){ return Standing; } public float getGPA(){ return GPA; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
