Question: public class Student { private int cin; private double gpa; public Student(int cin, double gpa) { super(); this.cin = cin; this.gpa = gpa; } public

public class Student { private int cin; private double gpa; public Student(int cin, double gpa) { super(); this.cin = cin; this.gpa = gpa; } public String toString(){ return "Student # " + cin + " has GPA of " + gpa; } }

in java

Write a CourseRoll class with an array list (not an array) of Students, an int field called nextCin, a reference to a Simulator (studentDriver class), and an instance method called offerClass(). OfferClass() uses the Simulator to get an array of 30 random Doubles from a Gaussian distribution that will be used to simulate GPAs. call getgaussianData() using arguments that are reasonable for GPAs (min of 2.0, max of 4.0, etc.) OfferClass() must instantiate 30 Students and add them to the list by calling Student's constructor from inside a loop. Each time you call the constructor, send nextCin and the next value in the array of doubles. Increment nextCIN each time, so that the first student's CIN is 1 and the last student's is 30. After you have created the list, use a loop to print out the data (from toString()) on each Student in the list. The first few lines of output should look like this:

Student # 1 has GPA of 4.0 Student # 2 has GPA of 3.77674628 Student # 3 has GPA of 3.66734843762

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!