/* Author : Michael Robinson Program : buildingSamples.java Purpose : To present Classes and Objects This program create five different objects from out own constructor, each object corresponds to a different constructor that received different data types. Updated : December 23, 2099 */ public class buildingSamples { //this section creates five global objects with different data //types no variables passed public static Building room0 = new Building(); //pass two ints public static Building room1 = new Building( 40, 20 ); //pass one double one int public static Building room2 = new Building( 40.5, 20 ); //pass one int one double public static Building room3 = new Building( 40, 20.7 ); //pass two doubles public static Building room4 = new Building( 40.5, 19.5 ); public static void doAccessors() { //these sections obtain the len, width and area of all rooms //(objects) //Accessors (gets) *************************************** System.out.printf( "\nRoom0\n" ); //display room0's Length System.out.printf( "Room0's length is %.2f\n", room0.getLength() ); //display room0's Width System.out.printf( "Room0's width is %.2f\n", room0.getWidth() ); //display room0's Area System.out.printf( "Room0's area is %.2f\n", room0.getArea() ); //display room1's Length System.out.printf( "\nRoom1\n" ); System.out.printf( "Room1's length is %.2f\n", room1.getLength() ); //display room1's Width System.out.printf( "Room1's width is %.2f\n", room1.getWidth() ); //display room1's Area System.out.printf( "Room1's area is %.2f\n", room1.getArea() ); //display room2's Length System.out.printf( "\nRoom2\n" ); System.out.printf( "Room2's length is %.2f\n", room2.getLength() ); //display room1's Width System.out.printf( "Room2's width is %.2f\n", room2.getWidth() ); //display room1's Area System.out.printf( "Room2's area is %.2f\n", room2.getArea() ); //display room3's Length System.out.printf( "\nRoom3\n" ); System.out.printf( "Room3's length is %.2f\n", room3.getLength() ); //display room3's Width System.out.printf( "Room3's width is %.2f\n", room3.getWidth() ); //display room3's Area System.out.printf( "Room3's area is %.2f\n", room3.getArea() ); //display room4's Length System.out.printf( "\nRoom4\n" ); System.out.printf( "Room4's length is %.2f\n", room4.getLength() ); //display room4's Width System.out.printf( "Room4's width is %.2f\n", room4.getWidth() ); //display room4's Area System.out.printf( "Room4's area is %.2f\n", room4.getArea() ); }//end public static void doAccessors() public static void doMutators() { System.out.println( "\nChanging measurements in the new" + " Building..." ); //now we change measurements in each room (object) //mutators (setters) *************************************** room1.setLength( 10 ); room1.setWidth( 4 ); room2.setLength( 10.9 ); room2.setWidth( 7 ); room3.setLength( 8 ); room3.setWidth( 14.4 ); room4.setLength( 10.2 ); room4.setWidth( 40.1 ); }//end public static void doMutators() public static void main( String arg[] ) { System.out.println( "Finding measurements in the new" + " Building" ); doAccessors(); doMutators(); doAccessors(); }//end public static void main( String arg[] ) }//end public class buildingSamples