Computer Science, asked by kshamadebnath12, 4 days ago

Write a program to input the measurement in feet and convert it into (i) Yard (ii) Inch​

Answers

Answered by gauthamn68
0

Answer:

Here is your answer :—

import java.util.Scanner;

class Question3 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("To convert yards into meter enter 1");

System.out.println("to convert inches into meter enter 2");

System.out.println("to convert feet into metre enter 3");

System.out.println("to exit the program press 0");

int choice = sc.nextInt();

double dis = 0;

switch(choice) {

case 0:

System.out.exit(0);

break;

case 1:

System.out.println("enter the distance in yards");

dis = sc.nextDouble();

System.out.println("distance in metre is "+ (dis*0.914));

break;

case 2:

System.out.println("enter the distance in inches");

dis = sc.nextDouble();

System.out.println("distance in metre is "+ (dis*0.0254));

break;

case 3:

System.out.println("enter the distance in yards");

double dis = sc.nextDouble();

System.out.println("distance in metre is "+ (dis*0.305));

break;

default:

System.out.println("Wrong choice");

break;

}

}

}

\begin{gathered} \\ \end{gathered}

Hope you understand :)

Explanation:

l hop it is helpful to you❤️

Similar questions