Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Objective: To learn the use of comments, and basic math operators.

Create a new folder called 'assign21' under C:\Java\Lesson2. Copy HelloWorld.java from Lesson 1 into it, and rename the file to "Temperature.java". Replace the word "HelloWorld" with "Temperature". Replace the System.out line with instructions to declare variables, and display output as described below:

Write a comment in the code that says "Converting degF to degC".

Use the following formula to compute the temperature in Centigrade using the temperature in Fahrenheit:

degree_Centigrade = ( degree_Fahrenheit - 32 ) X 5/9

Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables, each variable on a separate line. For example, the display may look like:

Temperature in Fahrenheit = 75.0

Temperature in Centigrade = 23.88888889

Write another comment in the code that says "Converting degC back to degF". On the next line, declare a new 'double' type variable called 'degFVerify' and then in the next line after that, using the degC computed above, back calculate the temperature in Fahrenheit and assign it to 'degFVerify', using the formula:
degree_Fahrenheit = (degree_Centigrade X 9/5) + 32
Verify that you get back the value of 75.0.

Display another message concatenating a label with the value of 'degFVerify', so that the message may look like:
Temperature in Fahrenheit (Verification) = 75.0
The output session may look like this:
C:\Java\Lesson2\assign21>javac Temperature.java
C:\Java\Lesson2\assign21>java Temperature
Temperature in Fahrenheit = 75.0
Temperature in Centigrade = 23.88888888888889
Temperature in Fahrenheit (Verification) = 75.0

Java, Programming

  • Category:- Java
  • Reference No.:- M9740697

Have any Question?


Related Questions in Java

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As