Explore BrainMass
Share

Java Student class that implements the Comparable interface.

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Write a student class in Java that implements the Comparable interface. The class has:

- Two instance variables studentId (String) and gpa (double). StudentId would contain six-digit Student Id, and the value of GPA is between 0.00 and 4.00.
- Two constructors with the following headers:
--> public Student(String studentId, double gpa)
--> public Student(double gpa)
- Two accessor methods: public String getStudentId(), and public double getGPA().
- A public String toString() method that displays student information in the following format: "Student Id: " + studentId + " GPA: " +gpa
- A public int compareTo(Object object) that will compare two Student objects based on their student Ids.

© BrainMass Inc. brainmass.com October 17, 2018, 12:01 pm ad1c9bdddf
https://brainmass.com/computer-science/java/java-student-class-that-implements-the-comparable-interface-562114

Solution Preview

Java version "1.7.0_21" was used during development and testing of attached program.

Attached 562114.zip contains two files: Student.java (Student class implementation) and StudentTest.java (test program to test Student class implementation).

562114/Student.java
562114/StudentTest.java

After unzipping the ...

Solution Summary

Java version "1.7.0_21" was used during development and testing of attached program.

$2.19
Similar Posting

productivity based solutions

Microsoft has expended a lot of effort into developing productivity tools for the Web, particularly with the .NET strategy. However, there are many other tools for creating Web solutions, eg. PHP, ColdFusion etc... The .NET strategy is extremely comprehensive, and yet there is always the continuing us versus Microsoft argument. Discuss the merits of adopting such an approach as a business strategy, and do you think it's wise given the enormous productivity gains offered by the .NET solutions? Compare any other productivity based solutions you may have come across in your readings.

Must provide all references.

View Full Posting Details