The document describes creating a program that converts temperatures from Fahrenheit to Celsius using a scanner class and for loop. It provides sample code to take user input of a temperature in Fahrenheit, convert it to Celsius using a formula, and output the results in a table from 32F to 212F in one degree increments.
Including Mental Health Support in Project Delivery, 14 May.pdf
Need to make a program using the scanner class that outputs F to C 3.pdf
1. Need to make a program using the scanner class that outputs F to C 32f-212 and 0c-100c. Do i
need to use a for loop? Please help thanks
A table needs to be made
Faren. Celsius
--------------------
32.00 | 0.00
ect | ect
212.00 | 100.00
-----------------------
output should look something like that 2 El import java util. Scanner public class Temp public
static void main (String args) Scanner input new Scanner System in) double celsius, fahrenheit;
10 System out print Enter a temperature in Fahrenheit fahrenheit input .next Double 12 celsius
(fahrenheit 32) 5 9; 14 System out println. I fahrenheit I celsius "I") for 17 18 20 21 22 23
Output X Tempo (run x Temp (run) #2 x Enter a temperature in Fahrenheit: 32 I 32.0 0.0 I
BUILD SUCCESSFUL (total time: 4 seconds
Solution
package org.students;
import java.text.DecimalFormat;
import java.util.Scanner;
public class FahrenheitToCelsius {
public static void main(String[] args) {
//Declaring variable
double tCelsius;
int tFah;
//DecimalFormat class is used to format the output
DecimalFormat df=new DecimalFormat("#.##");
//Scanner object is used to get the inputs entered by the user
Scanner sc=new Scanner(System.in);
System.out.print("Enter temperature(in Fahrenheit) :");
tFah=sc.nextInt();
System.out.println(" Faren.|Celsius");
System.out.println("----------------");