All pastes #263869 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-01 21:50 UTC
rendered paste body
import java.util.*;	//This is needed for the Scanner
import java.text.DecimalFormat; //Needed for decimals

public class RoomDimension
{
	private double length;  //This is the users set length
	private double width;	//This is the users set width
	private double area;	//This is the area needed for calculations

	public RoomDimension()
	{
	}

	/**
	      The toLength() method returns length
   */
	public double getLength()
	{
		return length;
	}

	/**
	      The getWidth() method returns width
   */
	public double getWidth()
	{
		return width;
	}

	/**
	      The setLengthWidth method
	      sets length and width to new variables
   */
	public void setLengthWidth(double len, double w)
	{
		length = len;
		width = w;
	}

	/**
	      The getArea method calls length and width
	      and calculates the area
   */
	public double getArea()
	{
		area = length * width;
		return area;
	}

	/**
      The toString method stores the
      variables to be displayed
   */

   public String toString()
	{
		DecimalFormat formatter = new DecimalFormat("#00.00");
		return "Room - length: " + length + " width: " + width + " area: " + area + "sw. ft";
	}


} //Closes RoomDimension class