Question: import java.util.Scanner; //package _solution; /** This program demonstrates how numeric types and operators behave in Java Do Task #1 before adding Task#2 where indicated. */

import java.util.Scanner;

//package _solution;

/**

This program demonstrates how numeric types and operators behave in Java

Do Task #1 before adding Task#2 where indicated.

*/

public class NumericTypesOriginal {

public static void main (String [] args) {

//TASK #2 Create a Scanner object here

Scanner keyboard = new Scanner (System.in);

//identifier declarations

final int NUMBER = 2 ; // number of scores

double score1; // first test score

double score2; // second test score

final int BOILING_IN_F = 212; // boiling temperature

double fToC; // temperature in Celsius

double average; // arithmetic average

String output; // line of output to print out

//Task #2 declare a variable to hold the users temperature

double inputTemp;

//Task #2 prompt user to input score1

System.out.print("What is the first score? ");

//Task #2 read score1

score1 = keyboard.nextDouble();

//Task #2 prompt user to input score2

System.out.print("What is the second score? ");

//Task #2 read score2

score2 = keyboard.nextDouble();

// Find an arithmetic average

average = (score1 + score2) / NUMBER;

output = score1 + " and " + score2 + " have an average of " + average;

System.out.println(output);

// Convert Fahrenheit temperatures to Celsius

fToC = (5/9) * (BOILING_IN_F - 32);

output = BOILING_IN_F + " in Fahrenheit is " + fToC + " in Celsius.";

System.out.println(output);

//Task #2 prompt user to input another temperature

System.out.print("Enter a temperature in Fahrenheit ");

//Task #2 read the users temperature in Fahrenheit

inputTemp = keyboard.nextDouble();

//Task #2 convert the users temperature to Celsius

fToC = (5/9) * (inputTemp - 32);

//Task #2 print the users temperature in Celsius

output = inputTemp + " in Fahrenheit is " + fToC + " in Celsius.";

System.out.println(output);

System.out.println("Goodbye"); // to show that the program is ended

}

}

This is my code so far, but I can't find the mistake in the conversion of Fahrenheit to Celsius

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!