import java.util.*; publicclass InputTest ...{ publicstaticvoid main(String[] args) ...{ Scanner in=new Scanner(System.in); // get first input System.out.print("what is your name?"); String name=in.nextLine(); //get Second input System.out.print("How old ar you?"); int age= in.nextInt(); //display output on console System.out.println("Hello,"+name+".Next year, you'll be "+(age+1)); System.out.printf("%,.2f",100000.0/3.0); } }
import java.util.*; publicclass Retirement ...{ publicstaticvoid main(String[] args) ...{ Scanner in =new Scanner(System.in); System.out.print("How much money do you need to retire?"); double goal=in.nextDouble(); System.out.print("How much money do you in every year?"); double payment=in.nextDouble(); System.out.print("interest rate in %"); double interestRate=in.nextDouble(); double balance=0; int years=0; while(years<=33) ...{ balance=balance+payment; double interest=(1+interestRate/100); balance=balance*interest; if(balance>=goal) break; years++; } System.out.println("You can retire in"+years+"years"); } }