Reference no: EM132316025
Assignment -
Part 1 - Modify the program given in the class examples section that finds the sum of integers in a file so that it finds and outputs the maximum value found in the file.
Hints: Read the first value in the file before the loop to initialize the maximum value.
Test with at least three different input file:
1. Max value is the first value in the file.
2. Max value is somewhere in the middle of the file.
3. Max value is the last value in the file.
Part 2 - Using the Circle class provided in the example called "Overriding toString, equals, and Implementing Comparable Interface", you will create a Program that mimics the ArrayList Processing example provided in the class examples.
You will do the following:
1. Create a project that includes the Circle class.
2. Create a Driver that does the following:
a. Fills an array list with 8 circles with different radii and 2 additional that are duplicates of one of the circles (10 total)
b. Removes the circles with the duplicate radii.
c. Prints the remaining circles (using toString), one per line.
Part 3 - Create a class called Box that extends the Rectangle class provided here. You should:
Provide an additional field called height.
Provide a constructor to initialize a Box object (using super).
Provide a setter for the new field.
Provide a getter for the new field.
Override the display method of the Rectangle class to display the correct information (you do not have to use super).
Add on to the Driver class so that it additionally creates a Box object and calls the display method
Hint: See the Inheritance example.
Part 4 - Create a Java Project in Eclipse with the following:
Include the Rectangle class supplied in Part 3.
Override the toString method for Rectangle.
Override the equals method for Rectangle.
Implement the comparable Interface for Rectangle (Compare by area).
Hint: provide a method in the Rectangle class called getArea that returns the area of a rectangle.
Include a Driver (similar to the one provided in the example) to demonstrate these new methods.