Question: Class Work Objectives: - Use private and public Access Modifier. - Define setters and getters methods. - Create a package and use the import statement.

Class Work Objectives: - Use private and public Access Modifier. - Define setters and getters methods. - Create a package and use the import statement. - Create an object and invoke all methods of this object. - Define a method with object parameter. - Invoke (Call) a method with object parameter. - Use the keyword this. to refer to the calling object itself. Question: Create a project named Box Project, and then write a Java application to: 1- Define a class Box in package shapes with these attributes: o length: length of box of type double. o width: width of box of type double. o height: height of box of type double. o label: label of box of type integer. Two constructors: Default constructor. Full Constructor. These methods: show () method. This method prints the information of the class box: i.e. length, width, height, label and volume. setter and getter methods for each attribute of the Box class. shapes Box - length: double - width: double - height: double - label: int + To Do: default constructor + full constructor + show(): void + To Do: setters + To Do: getters + volume(): double + compare(b: Box):intvolume () method. This method finds and returns the volume of a box by using this equation length * width * height compare (b: Box) method. This method compares between two box objects (depends on their volume) and returns the label of the bigger box or 0 if they have the same volume. 2- Define a main class named TestBox in package test and in the main method do the following: - Create two Box objects using the default constructor for the first object and the full parameters constructor for the second one. - Prompt the user to assign new values to the first object. - Prints the information of the two objects. - Change the height of the second object to be 30. - Print the new information of the second object after the updating. - Print the length of the first object. - Compare between the first and the second box then print the label of the bigger box by using a compare method.

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!