Program to convert temperature from fahrenheit to celsius

Assignment Help JAVA Programming
Reference no: EM131591338

For this assignment, you will be modifying the exercises from the previous assignment.

Change them to use a keyboard scanner instead of hard-coding values.

Use the nextLine() and parsing technique

We need to use the scanner
import java.util.Scanner;

Then created a keyboard reader

Scanner keyboard = new Scanner(System.in)

Write a Java program to convert temperature from Fahrenheit to Celsius.
public static void main(String[] args) {
double fahrenheit = 123.45;
double celcius = ((5 * (fahrenheit - 32.0)) / 9.0);

System.out.println("Exercise #1");
System.out.println(fahrenheit + "F is " + celcius + "C");
Output:
Exercise #1
Enter Fahrenheit: 123.45
123.45F is 50.80555555555556C
Exercise 2
Write a Java program that converts inches to meters
Use double variables inches and meters.
(One inch is 0.0254 meters)
public static void main(String[] Strings) {

Scanner input = new Scanner(System.in);

System.out.print("Input a value for inch: ");
double inch = input.nextDouble();
double meters = inch * 0.0254;
System.out.println("Exercise #2");
System.out.println(inch + " inch is " + meters + " meters");
Output:
Enter inches: 1000.0
1000.0 inches are 25.4 meters
Exercise 3
Concatenate first, middle, and last name
Create 3 Strings (firstName, middleInitial, and lastName)
Create 4th String variable named fullName and use the + operator to concatenate all parts of the name into one full name.
The user will input the data.
Enter your first name: Johhn
Enter your middle initial: J
Enter your last name: Jose

The full name is: John J. Jose
public static void main(String[] args) {
String fullName = "John J. Jose";
String lastName = fullName.substring(14);
System.out.println("Exercise #3");
System.out.println( "The full name is " + fullName);
Write a Java program to demonstrate the Java arithmetic operators
Name the integer variables x and y. That's okay to have single letter variables for this small demonstration.
Input x and y from the keyboard
Write the appropriate code to give this output:
public static void main(String args[]) {
int x = 11;
int y = 5;
System.out.println("Exercise #4");
System.out.println("11 + 5 = " + (x + y) );
System.out.println("11 - 5 = " + (x - y) );
System.out.println("5 - 11 = " + (y - x) );
System.out.println("11 * 5 = " + (x * y) );
System.out.println("11 / 5 = " + (x / y) );
System.out.println("11 % 5 = " + (x % y) );
}
Sample
Enter x: 12
Enter y: 6

12 + 6 = 18
12 - 6 = 6
6 - 12 = -6
12 * 6 = 72
12 / 6 = 2
12 % 6 = 0

Reference no: EM131591338

Questions Cloud

What is after-tax cost of the following preferred equity : What is the after-tax cost of the following preferred equity? The par value of the preferred share is $100 and the annual dividend is $7.00.
Identify some non quantitative factors : Straight Supply is a major supplier of medical components to large pharmaceutical corporations. Bonnie Straight is a second generation CEO of the company.
When is a method static and when is it not static : when is a method static and when is it not static? when is a method void and not void? what is a constructor in programming? can you explain this and give easy
Difference between the cash cycle and the operating cycle : What is the difference between the cash cycle and the operating cycle?
Program to convert temperature from fahrenheit to celsius : Write a Java program to convert temperature from Fahrenheit to Celsius - Change them to use a keyboard scanner instead of hard-coding values.
Explain the purpose of uninsured motorist coverage : Explain the purpose of Uninsured Motorist coverage? What is the major benefit of diversification? How does diversification work?
Java application using netbeans ide : Java application using NetBeans IDE to meet these additional and changed business requirements - java application should meet these technical requirements
Compute the present value-using the discount rates : Compute the present value of $1,050 paid in three years using the following discount rates:
Ci for her expected proportion of the vote : If, based on a sample size of 200, a political candidate found that 125 people would vote for her in a two-person race.

Reviews

Write a Review

JAVA Programming Questions & Answers

  What would the code look like for a java program

What would the code look like for a java program that computes the average of those three doubles

  Write the method called print triangle type.

Write the method called printTriangleType. This method accepts three integer arguments representing the lengths of the sides of a triangle and prints the type of triangle that these sides form. Here are some sample calls to printTriangleType

  Define both abstract methods inherited from disease class

Each of these classes extend the Disease class. Each of these class must define (override) both abstract methods inherited from disease

  Explain how operating systems and abstraction are related

Compare and contrast System Software and Application Software. Give an example of each. Abstraction is an important quality of an Operating System. Explain how Operating Systems and abstraction are related

  Complete the method named countoutofrange

The element is greater than or equal to min AND less than or equal to max. The method should return the new array -

  Design a class to represent a credit card

This material is somewhat more theoretical than that of previous topics, so instead of writing a program for this assignment, you are going to work on a design

  Create a guessing game

Create a guessing game where the user enters an integer between 1 and 10.

  Create a program in java that displays hello world

Create a program in Java that displays "Hello world!", No Design Section is required for this assignment, Copy and Paste your code into the Source Programs section and a screen shot of the results in the Output section.

  Program for a grading system

Must use file operations, exception handling, recursive programming (to calculate averages), and encapsulation (or inheritance) in the program. Program for a grading system to be used by students and professors

  Provide platform portability for developing applications

How does Java provide platform portability for developing applications? Describe the process of creating Java applications using Java SE and an IDE

  Design and develop a console application

Required to design and develop a console (text-based) application for a small car servicing company -

  Calculator to indicate sale prices when he marks items down

A retailer would like a calculator to indicate sale prices when he marks items down at various percentages.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd