1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.
import java.util.Scanner;
public class App {
public static void main(String[] args) {
Scanner keyBoard = new Scanner(System.in);
int dollars = -1;
while (dollars < 0 || dollars > 1000000) {
System.out.print("Enter number of dollar(s): ");
dollars = keyBoard.nextInt();
}
double pesos = dollars * 50.60;
System.out.println(dollars + " dollar(s) = " + pesos + " pesos");
keyBoard.close();
}
}
Comments
Leave a comment