Question
In this assignment you will create two Java programs: The first program will be a class that holds information (variables) about an object of your
In this assignment you will create two Java programs:
The first program will be a class that holds information (variables) about an object of your choice and provides the relevant behavior (methods)
The second program will be the main program which will instantiate several objects using the class above, and will test all the functions (methods) of the class above.
You cannot use any of the home assignments as your submitted assignment.
Your programs must meet the following qualitative and quantitative criteria:
Your class must:
Contain at least 5 instance variables (0.5 marks)
Contain at least 2 methods other than the constructor (2 marks)
Provide a toString() method to print the data of an object in an appropriately formatted string (this does not count as one of the two methods above). (0.5 marks)
The main program must:
Read its data from System.In using a sentinel value to detect the end of the input. (1 mark)
Ensure that input errors will be handled correctly (0.5 marks)
Instantiate an array of objects of your class above, using the data input by the user to construct the objects (0.5 marks)
Test both methods of the class above (1 mark)
Print the content of the object array using the formatted printing method provided by the class (1 mark)
Have correct style (use of the standard template, use of comments, correct alignment of statements, good choice of names, appropriate use of case) (1 mark) I really hope if I can get some actual examples for each requirement, Thank you very much :)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started