View more random threads:
- What does constructor do in class?Why we use copy...
- Java is used for Distributed/Network Oriented
- how can we make java "class" file as exe file. So that we...
- Using wait and notify? in java 2011-12
- Print function java code 2011
- Programming Languages Future html,c++,Assemply,Object...
- Java is to Write Once Run Anywhere thats what java language
- what is Reduced on this page: MySQL 25.00%
- Float datatype in java 2011
- Error 1721: There is a problem with this Windows Installer...
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)