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:
- Has fields for id, maximum score and score obtained
- should assign automatically unique id for each object starting from 1 (Hint: Think of static member)
- Has getter and setter methods for all the fields
- Has possible constructor to create objects with and without given values
- Has methods to get percentage score and letter grade. The letter grade is decided as follows:
- 'A' for score 90% or above
- 'B' 80% or above but less than 90%
- 'C' 70% or above but less than 80%
- 'D' 60% or above but less than 70%
- 'F' otherwise
- Should have equals method to compare two test objects and they will be same if id of one test is same as the other
- Should have toString method to return the complete information about the test
Create a MainClass with the following methods.
- 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.
- Create a static methodprintTestt(), which should accept test object as a parameter and print all the information about the test.
- 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
