Purchase Solution

Java Student class that implements the Comparable interface.

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Solution Summary

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

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 ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

C# variables and classes

This quiz contains questions about C# classes and variables.