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 101 (Hint: Think ofstatic...


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 101 (Hint: Think of

static member)

-


Has getter and setter methods for all the fields. The minimum value for the score

obtained can be 0 or less than maximum score.

-


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 and

maximum score of one test is same as the other

-


Should have toString method to return the complete information about the test i.e. id,

maximum score and score obtained.

Create a MainClass with the following methods.

-


Create a static method


createTest()
, which should accept the information about the test

from the user. After that it should create and return the test object. The test object

should be created only if valid information is provided.

-


Create a static method


printTest()
, 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 test.


Lab # 7 – More about classes (weight 3%) Instructions: · Submit the solution i.e. Java File along with execution screen by 5:00 pm. · Late lab is not accepted and will be graded as ‘0’. Problem: 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 101 (Hint: Think of static member) · Has getter and setter methods for all the fields. The minimum value for the score obtained can be 0 or less than maximum score. · 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 and maximum score of one test is same as the other · Should have toString method to return the complete information about the test i.e. id, maximum score and score obtained. Create a MainClass with the following methods. · Create a static method createTest(), which should accept the information about the test from the user. After that it should create and return the test object. The test object should be created only if valid information is provided. · Create a static method printTest(), 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 test. Submission: Take a screen shot of both the classes and output and submit. Grading: 2 point – Test class with all the features · Providing methods for equals() and toString() (0.5 point) · Providing methods for percentage and letter grade (0.5 point) · Providing possible constructors (0.5 point) · Providing the remaining features as per the requirement (0.5 point) 1 point – Main class · Provided createTest() and printTest() methods (0.5 point) · Main is implementing the logic using the proper objects and methods. (0.5 point)
























Nov 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here