SUBMIT REPORT User: aboutams Name: Mohamed S Aboutabl Course: cs139a Assignment: pt1 Version: 2 Date: Thu Sep 16 04:14:48 PM 2004 Files: RodConverter.java PDF-spec: 90/99 Honor Pledge: I have NOT received unauthorized assistance Compiling ... j139c RodConverter.java /aux/bin/progtst -C -v -f test-report pt1 *** PROGRAM TEST *** Assignment: pt1 Test Dir: /fs/home-f/aboutams/cs139.d/assign.d/pt1.d Test Cnt: 5 Test 01: (pt1 <--- Test 01: your err-output is empty ---> <--- Test 02: model err-output is empty ---> <--- Test 02: your err-output is empty ---> <--- Test 03: model err-output is empty ---> <--- Test 03: your err-output is empty ---> <--- Test 04: model err-output is empty ---> <--- Test 04: your err-output is empty ---> <--- Test 05: model err-output is empty ---> <--- Test 05: your err-output is empty ---> 2004-09-16 16:15 RodConverter.java Page 1 1 // ************************************************************* 2 // Name: Mohamed Aboutabl 3 // Date: 9/15/2004 4 // Assignment: Programming Assignment #1 RodConverter.java 5 // 6 // ************************************************************* 7 // References & Acknowledgements: I received no outside help 8 // 9 // ************************************************************* 10 // Name of the class: RodConverter 11 // Purpose of the class:Convert rods to yards and miles 12 // ************************************************************* 13 14 import java.text.DecimalFormat ; 15 import cs1.Keyboard ; 16 17 public class RodConverter 18 { 19 /**---------------------------------------------------------- 20 // Read in a distance in rods and display the equivalent 21 // yards and miles 22 // --------------------------------------------------------*/ 23 public static void main( String[] args) 24 { 25 // Variables Declarations 26 double rods, // number of rods to convert 27 yards , // equivalent yards 28 miles ; // equivalent miles 29 30 final double YARDS_PER_ROD = 5.5 , // Conversion constants 31 YARDS_PER_MILE = 1760.0 ; 32 33 DecimalFormat twoDecimals; 34 twoDecimals = new DecimalFormat("0.00") ; 35 36 // Print the header 37 System.out.println("\n\t\t\tRod Converter\n"); 38 39 // Get the number of rods to convert then echo the values 40 System.out.print("Enter the number of rods to convert: "); 41 rods = Keyboard.readDouble() ; 42 System.out.println("\nNumber of rods:\t" + twoDecimals.format(rods) ); 43 44 // Convert to yards and miles 45 yards = rods * YARDS_PER_ROD ; 46 miles = yards / YARDS_PER_MILE ; 47 48 49 // Format and display the results on the screen 50 51 System.out.println("\nNumber of yards:\t" + twoDecimals.format(yards) ); 52 System.out.println("Number of miles:\t" + twoDecimals.format(miles) ); 53 54 // Dsiplay the exit message 55 System.out.println("\n\t\tExiting program Rod Converter"); 56 57 } 58 }