Question: box flile public class Box { // Convert the public variables to private public double length; public double width; public double height; //Complete the bellow

 box flile public class Box { // Convert the public variables

box flile

public class Box { // Convert the public variables to private public double length; public double width; public double height; //Complete the bellow constructors public Box() { } public Box(double length, double width, double height) { } // Write down the set and get methods for all the variables public void setLength(double length) { } public void setWidth(double width) { } public void setHeight(double width) { } public double getLength() { return 0; } public double getWidth() { return 0; } public double getHeight() { return 0; } // Complete the get volume method public double getVolume(){ return length*width*height; } }

runner file

import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner;

public class Runner { public static void main(String args[]) throws FileNotFoundException { File file = new File("/Users/afarhan/eclipse-workspace/CS2401_LAB3/src/boxfile.txt"); //Creating Scanner instnace to read File Scanner scnr = new Scanner(file); // First line of text file that give us the number of boxes String n_str = scnr.nextLine(); int n = Integer.parseInt(n_str); // Box class Array Box boxes[] = new Box[n]; // Scanning each row of the text file and making boxes with the len,width,height values int i = 0; while(i

}

* * /* Description: * 1. Complete the Box file a. Complete the constructors b. Write down the set and get methods for variables * 2. Read the boxfile.txt using scanner First line of the file contains how many boxes are there .. Following N rows contains length, width, height of each boxes * 3. Create Box class Array * 4. Store all the rows in the Box class array using get set method or Constructor * * * * 5. Find the box with maximum length * 6. Find the box with minimum length * 7. Compute volume of each boxes and print that * 8. Find the box with max volume * 9. Find the box with min volume */

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!