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

Need JAVA code for this assignment Project Number II [after chapter 3] 1} Place

ID: 3751358 • Letter: N

Question

Need JAVA code for this assignment

Project Number II [after chapter 3]

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

it will convert Celsius temperature to its corresponding Fahrenheit temperature

it will convert a distance of inches to its corresponding value in centimeters.

It will convert an angle measurement from degrees to radians

Enter 1 for C to F

Enter 2 for in to cm

Enter 3 for degrees to radians”

4)            Scanner keyboard = new Scanner (System.in);

choice = keyboard.nextInt();

5)            Test to make sure only a 1, 2 or 3 are entered i.e

If choice < 1 || choice > 3{

                System.out.println (“ Incorrect entry, please enter 1 , 2 or 3”);

                                choice = keyboard.nextInt();

             }

6)           Use an if statement to test choice for a value of 1, and then execute the code for the temperature conversion.

7)         Enclose the temperature code with braces tying it to the if statement

8)            Use an if statement to test choice for a value of 2, and then execute the code for the conversion of inches to centimeters.

9)           Enclose the inches to centimeters code with braces tying it to the if statement.

10)          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.

14)          Test the programs with a Celsius number. This will test the if logic

15)        Test the program with an inches value. This will 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)

Fahrenheit= (9.0/5.0)*Celsius + 32.0

Centimeters= 2.54 times inches

Radians= Degrees times 3.14159 divided by 180.0

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

import java.util.Scanner;

import java.io.*;

class Main {

public static void main(String[] args) {

int choice;

double in, out;

System.out.print("This program provides the following capabilities it will convert Celsius temperature to its corresponding Fahrenheit temperature it will convert a distance of inches to its corresponding value in centimeters. It will convert an angle measurement from degrees to radians Enter 1 for C to F Enter 2 for in to cm Enter 3 for degrees to radians ");

Scanner n = new Scanner(System.in);

choice = n.nextInt();

//If the choice is not 1,2 or 3, system displays error and ask to enter input again

if(choice <1 || choice >3){

System.out.print(" Incorrect entry, Please enter 1,2 or 3: ");

choice = n.nextInt();

}

//If the choice is 1 below code is for temperature covertion

if(choice == 1){

System.out.print("Welcome to temperature convertion: Enter temperature in Celsius: ");

in=n.nextDouble();

out = ((9/5)*in)+32;

System.out.printf("Fahrenheit Temperature = " + "%f", out);

}

//If the choice is 2, below code is for covertion of inches to centimeters

if(choice == 2){

System.out.println("Welcome to convertion of inches to centimeters: ");

System.out.println("Enter input inches");

in=n.nextDouble();

out = (in*2.54);

System.out.printf("Centimeters =" + "%f", out);

}

// If the input is 3, below code is for coversion of degrees to radians

if(choice == 3){

System.out.println("Welcome to convertion of degrees to radians: Enter Degrees: ");

in=n.nextDouble();

out = (in*3.14159)/180;

System.out.printf("Radians = " + "%f", out);

}

return;

}

}

// You can run the above program using link: https://repl.it/@sindhuvegi/f-to-c-temperature-conversion-cm-to-inch

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