import java.util.Scanner;
public class YardsToFeetConverter {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Scanner input = new Scanner(System.in);
String name = "";
int value = 0;
int result = 0;
String tryng = "";
do {
System.out.println("Please provide value and press Enter: ");
value = input.nextInt();
System.out.println("Please provide f- Feet or y if Yard and press Enter: ");
name = scan.nextLine();
if (name.equals("y")) {
result = value * 3;
System.out.println("Entered value of Yards are eqals: " + result + " Feet");
} else if (name.equals("f")) {
result = value / 3;
System.out.println("Entered value of Feet are eqals: " + result + " Yards");
}
System.out.println("One more? If Yes provide y of No provide n and press Enter: ");
tryng=scan.nextLine();
} while (!tryng.equals("n"));
scan.close();
input.close();
}
}
Comments
Leave a comment