@@ -0,0 +1,944 @@
+// Use a return value.%0A%0Aclass Vehicle %7B%0A%09int passengers; // number of passengers%0A%09int fuelcap;    // fuel capacity in gallons%0A%09int mpg;        // fuel consumption in miles per gallon%0A%09%0A%09// Display the range.%0A%09int range() %7B%0A%09%09return mpg * fuelcap;%0A%09%7D%0A%7D%0A%0Aclass RetMeth %7B%0A%09public static void main(String args%5B%5D) %7B%0A%09%09Vehicle minivan = new Vehicle();%0A%09%09Vehicle sportscar = new Vehicle();%0A%09%09%0A%09%09int range1, range2;%0A%09%09%0A%09%09// assign values to fields in minivan%0A%09%09minivan.passengers = 7;%0A%09%09minivan.fuelcap = 16;%0A%09%09minivan.mpg = 21;%0A%09%09%0A%09%09// assign values to fields in sportscar%0A%09%09sportscar.passengers = 2;%0A%09%09sportscar.fuelcap = 14;%0A%09%09sportscar.mpg = 12;%0A%09%09%0A%09%09// get the ranges%0A%09%09range1 = minivan.range();%0A%09%09range2 = sportscar.range();%0A%09%09%0A%09%09System.out.print(%22Minivan can carry %22 + minivan.passengers + %22 with range of %22 + range1 + %22 miles%22);%0A%09%09%0A%09%09System.out.print(%22Sportscar can carry %22 + sportscar.passengers + %22 with range of %22 + range2 + %22 miles%22);%0A%09%7D%0A%7D%0A

Use a return value