Question

In: Computer Science

In Java: Write a program called F2C that allows the user to convert from degrees Fahrenheit...

In Java:

Write a program called F2C that allows the user to convert from degrees Fahrenheit to degrees Celsius. The program should prompt for a temperature in Fahrenheit and output a temperature in Celsius. All calculations should be done in in ints, so be careful of truncation.

Solutions

Expert Solution

Code Screenshot :

Executable Code:

//Scanner for user input
import java.util.Scanner;
public class F2C {
       public static final void main(String[] args) {
           Scanner scan = new Scanner (System.in);
           int celcuis,fahrenheit;
           //Prompting the user for input
               System.out.print("Fahrenheit: ");
               //Reading the input
               fahrenheit = scan.nextInt();
               //Converting farenheit to celcius
               celcuis = (fahrenheit-32)*5/9;
               //Printing the result
               System.out.println("Celcius: "+celcuis);
       }
}

Sample Output :

Please comment below if you have any queries.
Please do give a thumbs up if you liked the answer thanks :)


Related Solutions

Write a java program to convert Celsius degrees to Fahrenheit degrees the user enters degrees in...
Write a java program to convert Celsius degrees to Fahrenheit degrees the user enters degrees in Celsius and the program Coverts the input to Fahrenheit using the following formula T(°F) = T(°C) × 1.8 + 32 submit the source code Design output Load: 1. Design (Pseudocode ) 2. Source file (Java file, make sure to include comments) 3. Output file (word or pdf or jpig file)
Java Script Ask the user for a Fahrenheit temperature Write the code needed to convert a...
Java Script Ask the user for a Fahrenheit temperature Write the code needed to convert a Fahrenheit temperature into a Celsius temperature. Use an alert box to show the result Ask the user for a Celsius temperature Write a function to convert from Celsius to Fahrenheit; use an alert box to show the results Decide on two other conversions (meters to feet, pounds to kilos, other) Ask the user for numbers to be converted; be sure to tell them what...
Please write the code JAVA Write a program that allows the user to enter the last...
Please write the code JAVA Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate      Votes Received                                % of Total Votes...
Java Programming: Write a program that allows the user to compute the power of a number...
Java Programming: Write a program that allows the user to compute the power of a number or the product of two numbers. Your program should prompt the user for the following information: • Type of operation to perform • Two numbers (the arguments) for the operation to perform The program then outputs the following information: • The result of the mathematical operation selected. Menu to be displayed for the user: MATH TOOL 1. Compute the power of a number 2....
Write a Java program that allows the user to specify a file name on the command...
Write a Java program that allows the user to specify a file name on the command line and prints the number of characters, words, lines, average number of words per line, and average number of characters per word in that file. If the user does not specify any file name, then prompt the user for the name.
in java Write a contacts database program that presents the user with a menu that allows...
in java Write a contacts database program that presents the user with a menu that allows the user to select between the following options: Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...
Write a program that displays a temperature conversion table for degrees Celsius and degrees Fahrenheit. The...
Write a program that displays a temperature conversion table for degrees Celsius and degrees Fahrenheit. The table should include rows for all temperatures between 0 and 100 degrees Celsius that are multiples of 10 degrees Celsius. Include appropriate headings on your columns. The formula for converting between degrees Celsius and degrees Fahrenheit can be found on the internet. Python 3
JAVA Programming (Convert decimals to fractions) Write a program that prompts the user to enter a...
JAVA Programming (Convert decimals to fractions) Write a program that prompts the user to enter a decimal number and displays the number in a fraction. Hint: read the decimal number as a string, extract the integer part and fractional part from the string, and use the Rational class in LiveExample 13.13 to obtain a rational number for the decimal number. Use the template at https://liveexample.pearsoncmg.com/test/Exercise13_19.txt for your code. Sample Run 1 Enter a decimal number: 3.25 The fraction number is...
Java Programing Write a program called reverseProg.   This program will do the following Asks the user...
Java Programing Write a program called reverseProg.   This program will do the following Asks the user to input a string, it reads the string and does the followings Prints the string in reverse order. Displays the characters that are in position 7th, 8th and 9th of this string Displays the length of the string Displays the string in all UPPER CASE Sample output example: Enter a string: Wilmington University String Entered is: Wilmington University Wilmington University spelled backward is: ytsirevinU...
Write a program that read the input from user and convert it to binary and hex...
Write a program that read the input from user and convert it to binary and hex in C language.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT