I am just learning to use Java and I am trying to make a simple Yards to feet or Inches to CM converter. I have made the Yards to feet converter and it works but now I want the user to get an option to pick between using the Y/f or the I/C converter. How do I make them pick an option between the two. Here's what I have coded so far:
import java.util.Scanner;
public class yardcalc {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
double Feet = 0;
double yard = 0;
int format = 3;
System.out.println("Enter yard(s): "); //Asks the user for the amount of yards
yard = keyboard.nextDouble();
Feet = (double) yard / (int) format;
System.out.println("Feet: " + Feet);
}
}
import java.util.Scanner;
public class yardcalc {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
double Feet = 0;
double yard = 0;
int format = 3;
System.out.println("Enter yard(s): "); //Asks the user for the amount of yards
yard = keyboard.nextDouble();
Feet = (double) yard / (int) format;
System.out.println("Feet: " + Feet);
}
}