package com.example.domain;

public class Box {

	// instance variables
	// default access modifier - accessible within the package only
	public double width;
	public double height;
	public double depth;
	public String name;

	public Box() {
		System.out.println("Box constructor executed...");
		width = 10;
		height = 10;
		depth = 10;
		name = "box";
	}
	
	// parameterized constructor
	public Box(double width, double height, double depth, String name) {
		System.out.println("Box parameterized constructor executed...");
		this.width = width;
		this.height = height;
		this.depth = depth;
		this.name = name;
	}

	public double calculateVolume() {
		// calculate volume for box
		return width * height * depth;
	}

	public void display() {
		System.out.println("Width = " + width);
		System.out.println("Height = " + height);
		System.out.println("Depth = " + depth);
		System.out.println("Name = " + name);
		System.out.println();
	}

	// method that takes parameters
	public void setDimension(double width, double height, double depth, String name) {
		this.width = width;
		this.height = height;
		this.depth = depth;
		this.name = name;
	}
	
	@Override
	public String toString() {
		return "== Box Details ==\n" +
				"Name = " + name + "\n" +
				"Width = " + width + "\n" +
				"Height = " + height + "\n" +
				"Depth = " + depth + "\n" +
				"Volume = " + calculateVolume() + "\n";
	}
}
