Question: Project1 Class Project1 class should have three private methods and one public method. Methods 1. A private class method named findMinimum with a return type

Project1 Class

Project1 class should have three private methods and one public method.

Methods

1. A private class method named findMinimum with a return type of Weight. This method should accept three Weight objects as parameters and compare each Weight objects weight values to find the minimum. The Weight object with the minimum weight value should be returned and then printed using toString in the following format:

The minimum weight is x pounds and y ounces

where x is the number of pounds and y the number of ounces. Ounces should be displayed with two decimal places.

2. A private class method named findMaximum with a return type of Weight. This method should accept three Weight objects as parameters and compare each Weight objects weight values to find the maximum. The Weight object with the maximum weight value should be returned and then printed using toString in the following format:

The maximum weight is x pounds and y ounces

where x is the number of pounds and y the number of ounces. Ounces should be displayed with two decimal places.

3. A private class method named findAverage with a return type of Weight. This method should accept three Weight objects as parameters and calculate the average weight value. A new Weight object with the average weight values should be returned and then printed using toString in the following format:

The average weight is x pounds and y ounces

where x is the number of pounds and y the number of ounces. Ounces should be displayed with two decimal places.

4. A public method named main with a return type of void. This method should exercise the correct functionality of findMinimum, findMaximum and findAverage by creating three Weight objects using the hardcoded values below:

Weight weight1 = new Weight(11, 3);

Weight weight2 = new Weight(7, 20); // Hint: normalize method should be used to translate into 8 pounds and 4 ounces

Weight weight3 = new Weight(14, 6);

Submission Requirements Style and Documentation Make sure your Java program is using the recommended style such as: J

avadoc comment with your name as author, date, and brief purpose of the program

Comments for variables and blocks of code to describe major functionality

Meaningful variable names and prompts

Class names are written in upper CamelCase

Constants are written in All Capitals

Use proper spacing and empty lines to make code human readable Deliverables The submission requires uploading a single zip file, which will contain: 1. The source code of Project1.java (do not include the class file)

2. A single document (DOC/DOCX or PDF), which includes the test case(s) in a tabular format and screenshot(s) of the test runs for the test case(s). Do not submit the screenshot(s).

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!