area(double,double) in Rectangle cannot be applied to ()
return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter(); ^
perimeter(double,double) in Rectangle cannot be applied to ()
return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter();
^
setSides(double,double) in Rectangle cannot be applied to (double)
R.setSides(input.nextDouble());
^
3 errors
Tool completed with exit code 1
Can anybody tell me why it is doing this? Thanks in advance!
Expand|Select|Wrap|Line Numbers
- import java.util.Scanner;
- public class Rectangle
- {
- public double length;
- public double width;
- public Rectangle()
- {
- length = 0;
- width = 0;
- }
- public double getSides()
- {
- return length;
- return width;
- }
- public void setSides(double length, double width)
- {
- this.length = length;
- this.width = width;
- }
- public double area(double length, double width)
- {
- double area = length * width;
- return area;
- }
- public double perimeter(double length, double width)
- {
- double perimeter = (length * 2) + (width * 2);
- return perimeter;
- }
- public String toString()
- {
- return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter();
- }
- public static void main(String [] args)
- {
- Rectangle R = new Rectangle();
- Scanner input = new Scanner(System.in);
- System.out.println("Enter radius: ");
- R.setSides(input.nextDouble());
- System.out.println(R.toString());
- }
- }