Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Carpet Calculator help?

$
0
0
This is a class to my Carpet Calculator. Can anyone help me with why these errors come up?


public class RoomDimension {
	private double length;	//Stores Length
	private double width;	//Stores Width
	private static int dimCount = 0;	//Counts Instances
	
	// No-Arg
	
public RoomDimension() {
			setLength(0.0);
			setWidth(0.0);
			dimCount++;
	}
		
	//Parameterized
	
public RoomDimension(double l, double w, int d) {
			length = l;
			width = w;
			dimCount = d;
	}
	
	//Copy Constructor
	
public RoomDimension(RoomDimension room1) {
			length = room1.length;	
			width = room1.width;
	}
	
	//Copy Method
	
public RoomDimension copy() {
			RoomDimension copyDim = new RoomDimension(length, width);
			return copyDim;
	}
	
	//Sets length
	
public void setLength(double l) {
			length = l;
	}
	
	//Sets Width
		
public void setWidth(double w) {
			width = w;
	}
	
	//Sets Counter
	
public void setDimCount(int d) {
			dimCount = d;
	}
	
	//Gets Length
	
public double getLength() {
			return length;
	}
		
	//Gets Width	
		
public double getWidth() {
			return width;
	}
		
	//Gets Area of Length and Width	
		
public double getArea() {
			return length * width;
	}	
	
	//Gets number of Instances counted
	
public int getDimCount() {
			return dimCount;
	}
		
	//Equals Method
		
public boolean equals (RoomDimension room1) {
	boolean status;
			if (length.equals(room1.length) && width == (room1.width))
				status = true;
			else
				status = false;
	}
		
	//toString to return all results and counter	
		
public String toString() {
			String result = "Length:" +getLength()+ 
							"Width:" +getWidth()+ 
							"Area:" +getArea()+
							"Instances" +getDimCount();
			return result;
	}

}		



Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>