Question: Assignment Write a Java Program: Part 1 Draw the UML diagram for a class named Pool. Choose your own file name. Part 2 Write the

Assignment Write a Java Program:

Part 1 Draw the UML diagram for a class named Pool. Choose your own file name.

Part 2 Write the code to define a class named Pool. File name: FirstNameLastNamePool.java

Part 3 Write the code to test the functionality of the Pool class by defining objects and using the methods of the class. File name: FirstNameLastNameTestPool.java

Part 4 Write the code to define a class named Information. File Name: FirstNameLastName Information.java

Part 5 - Write the code to test the functionality of the Information class by defining objects and using the methods of the class. File Name: FirstNameLastNameTestInformation.java

Process:

Part 2 - Specification of the Pool class: The class should have private instance fields to store the shape of a pool (oval, rectangular, etc.), length (in feet), width (in feet), depth (in feet), area (in square feet) and the volume (in cubic feet) of the pool. Also provide the following methods:

A no-arg constructor to initialize the instance variables.

A Constructor with parameters to initialize the instance variables to the arguments indicated in the parameter list of the constructor.

Appropriate methods to set the value of each of the private instance fields.

Appropriate methods to get the value of each of the private instance fields.

A method to calculate and return the area of the pool. The area is calculated by multiplying length and width. So, area = length * width

A method to calculate and return the volume of the pool. The volume is calculated by multiplying depth by length and width. So, volume = length * width * depth

A method to display the values of all of the variables. This is just a method with a bunch of output statements for all of the instance variables.

Part 3 - Specification of the Test class for Pool: Write a main program that uses the class Pool and test various operations on the objects of the class. Perform a series of operations to test each of the methods and the constructors. Make sure to prompt the user for input as you test your code. Create an array of 10 objects of the Pool class and show the functionality of the class with your array.

Part 4 - Specification of the Information class: The class named Information that contains:

An int data field representing the identification number for an item

A String data field representing the name of an item

A no-arg constructor to initialize the field members, so identification number is 1000 and the name = "desk"

A constructor to create an object with a given identification number and a name

A copy constructor that accepts an object of the class Information and sets the data values, accordingly.

Appropriate Setter and Getter methods

A toString() method to allow for displaying the values of data fields. This method should return the values of the data fields.

Part 5 - Specification of the Test class for Information: Define a test class that includes the main method to define at least 3 objects showing the use of constructors and methods of the class. Make sure to prompt the user for input as you test your code.

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!