Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need JAVA code for this question: Ratings will be given to the user with answer,

ID: 3751359 • Letter: N

Question

Need JAVA code for this question:
Ratings will be given to the user with answer, Thank you!

Project Number 2 1)Place this statement after the other import statement in your code "import java.util.Scanner" 2) Define an integer named choice 3)Use a System.out.println to print out a menu of this sort to the user "This program provides the following capabilities 1) it will convert celcisus temperature to its corresponding Fahrenheit temperature 2) it will convert a distance of inches to its corresponding value in centimeters 3) It will convert an angle measurement from degres to radians Enter for C to F Enter 2 for in to cm Enter 3 for degrees to radians" Scanner keyboard new Scanner (System.in); choice keyboard.nextlntO; Test to make sure only a 1, 2 or 3 are entered i.e Ifchoice 3f System.out.println (" Incorrect entry, please enter 1, 2 or 3"); 4) 5) choice -keyboard.nextlnt); 6) 7) Enclose the temperature code with braces tying it to the if statemernt 8) Use an if statement to test choice for a value of 1, and then execute the code for the temperature conversion Use an if statement to test choice for a value of 2, and then execute the code for the conversion of inches to centimeters Enclose the inches to centimeters code with braces tying it to the if statement 9) Use an if statement to test choice for a value of 3, then execute the code for the conversion of degrees to radians 11)Leave the exit statement outside the 3 if statement blocks of code 12) Exit the program 13)Place comments describing the set of steps that follow in the logic of the program 4) Test the programs with a Celcius number. This will test the if logic 15)Test the program with an inches value. This ill test the if logic 16) Test the program with an angle value. This will test the if logic Celsius temperature 5/0/9.0 times (Fahrenheit minus 32.0) Faherheit-9.0/5.0)*Celsius + 32.0 Centimeters 2.54 times inches Radians- Degrees times 3.14159 divided by 180.0

Explanation / Answer

CelsiusToFahInToCmDegToRad.java

import java.util.Scanner;

public class CelsiusToFahInToCmDegToRad {

public static void main(String[] args) {

//Declaring variables
int choice;
double celsius, fahrenheit, inches, cms, degrees, radians;

/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);

//displaying the menu
System.out.println("1.it will convert celsius temperature to its corresponding Fahrenheit temperature.");
System.out.println("2.it will convert a distance of inches to its corresponding value in centimeters.");
System.out.println("3.it will convert an angle measurement from degrees to radians.");


//getting the choice entered by the user
System.out.print("Enter Choice :");
choice = sc.nextInt();

//If the user enters invalid choice display error message
if (choice < 1 || choice > 3) {
System.out.println("Incorrect entry,please enter 1,2 or 3");
choice = sc.nextInt();
}

//Based on the user choice the corresponding case will be executed
if (choice == 1) {
//Getting the input entered by the user
System.out.println("Enter temperature in celsius (C):");
celsius = sc.nextDouble();
//Displaying the output
System.out.printf("%.2f C is %.2f F ", celsius, celsiusToFahrenheit(celsius));
} else if (choice == 2) {
//Getting the input entered by the user
System.out.println("Enter distance in inches (in):");
inches = sc.nextDouble();
//Displaying the output
System.out.printf("%.2f inches is %.2f cms ", inches, inchesToCms(inches));
} else if (choice == 3) {
//Getting the input entered by the user
System.out.println("Enter angle in degrees :");
degrees = sc.nextDouble();
//Displaying the output
System.out.printf("%.2f degrees is %.2f radians ", degrees, degreesToRadians(degrees));
}


}

//This method will convert degrees to radians  
private static double degreesToRadians(double degrees) {
return (degrees * 3.14159) / 180;
}

//This method will convert inches to centimeters
private static double inchesToCms(double inches) {
return inches * 2.54;
}

//This method will convert celsius to fahrenheit
private static double celsiusToFahrenheit(double celsius) {
return (((9.0 / 5.0) * celsius) + 32.0);
}

}

__________________

Output#1:

1.it will convert celsius temperature to its corresponding Fahrenheit temperature.
2.it will convert a distance of inches to its corresponding value in centimeters.
3.it will convert an angle measurement from degrees to radians.
Enter Choice :4
Incorrect entry,please enter 1,2 or 3
1
Enter temperature in celsius (C):
45
45.00 C is 113.00 F

_______________

Output#2:

1.it will convert celsius temperature to its corresponding Fahrenheit temperature.
2.it will convert a distance of inches to its corresponding value in centimeters.
3.it will convert an angle measurement from degrees to radians.
Enter Choice :2
Enter distance in inches (in):
45.5
45.50 inches is 115.57 cms

______________

Output#3:

1.it will convert celsius temperature to its corresponding Fahrenheit temperature.
2.it will convert a distance of inches to its corresponding value in centimeters.
3.it will convert an angle measurement from degrees to radians.
Enter Choice :3
Enter angle in degrees :
45
45.00 degrees is 0.79 radians

________Could you plz rate me well.Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote