Question: Create a Test class with the following features: Has fields for id, maximum score and score obtained should assign automatically unique id for each object

Create a Test class with the following features:

  1. Has fields for id, maximum score and score obtained
  2. should assign automatically unique id for each object starting from 1 (Hint: Think of static member)
  3. Has getter and setter methods for all the fields
  4. Has possible constructor to create objects with and without given values
  5. Has methods to get percentage score and letter grade. The letter grade is decided as follows:
    1. 'A' for score 90% or above
    2. 'B' 80% or above but less than 90%
    3. 'C' 70% or above but less than 80%
    4. 'D' 60% or above but less than 70%
    5. 'F' otherwise
  6. Should have equals method to compare two test objects and they will be same if id of one test is same as the other
  7. Should have toString method to return the complete information about the test

Create a MainClass with the following methods.

  1. Create a static methodcreateTestt(), which should accept the information about the test from the user. After that it should create and return the test object.
  2. Create a static methodprintTestt(), which should accept test object as a parameter and print all the information about the test.
  3. Create a main method using the provided methods that should continue to accept the information about the test from the user and print the details of the testt.

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!