import java.util.Scanner; public class Chapter2_12 { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Enter speed and acceleration: "); double speed = input.nextDouble(); double acceleration = input.nextDouble(); double length = (int)((speed * speed / acceleration / 2) * 1000) / 1000.0; System.out.println("The minimum ruway length for this airplane is " + length); } }
import java.util.Scanner; public class Chapter2_13 { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Enter the monthly saving amount: "); double amount = input.nextDouble(); final double p = 0.00417; double accountValue = amount * (1 + p) * 5 + amount * Math.pow((1 + p),6); System.out.println("After the sixth month, the account value is $" + accountValue); } }