View more random threads:
- J2EE and JDK Path Setting why you recive the deployment...
- JAVA Download errors: 1305, 2755, 1606, etc.
- Editor does NOT contain a main type in Java 2011
- Is Java language is Distributed / Network Oriented?
- Java Programming !Help! in c++ 2011
- Float datatype in java 2011
- Why we are putting + sign in the start of variable and...
- The JVM "verifier" checks the code when it is loaded to...
- java correct code 2011
- what are the latest updates for Java May 2011
Code:import java.util.Scanner; public class rectangle { public static void main( String[] args ) { rectangle rec = new rectangle(); } double length = 1.0 double width = 1.0 double perimeter double area public class calcPerimeter() { perimeter = 2*length + 2*width; } public class calcArea() { area = length*width; } private double getLength() { return length; } private double getWidth() { return width; } private double setLength( length ) { double recLength = length; if (recLength > 0.0 && recLength < 20.0) { length = recLength; } } private double setWidth( width ) { double recWidth = width; if (recWidth > 0.0 && recWidth < 20.0) { width = recWidth; } } private void toString() { System.out.printf("%s%.2f" + " " "%s%.2f" + " " + "%s%.2f" + " " + "%s%.2f" + " " +, length, width, perimeter, area); } } // end main
Sponsored Links
There are currently 1 users browsing this thread. (0 members and 1 guests)