subject
Computers and Technology, 06.05.2020 02:28 bbb4951

Write a Temperature class that will hold a temperature in Fahrenheit and provide methodsto get the temperature in Fahrenheit, Celsius, and Kelvin. The class should have the followingfield: ftemp —A double that holds a Fahrenheit temperature. The class should have the following methods: Constructor—The constructor accepts a Fahrenheit temperature (as a double ) andstores it in the ftemp field. setFahrenheit —The setFahrenheit method accepts a Fahrenheit temperature (as adouble ) and stores it in the ftemp field. getFahrenheit —Returns the value of the ftemp field, as a Fahrenheit temperature (noconversion required). getCelsius —Returns the value of the ftemp field converted to Celsius. getKelvin —Returns the value of the ftemp field converted to Kelvin. Use the following formula to convert the Fahrenheit temperature to Celsius:Celsius _ (5/9) _ (Fahrenheit _ 32)Use the following formula to convert the Fahrenheit temperature to Kelvin:Kelvin _ ((5/9) _ (Fahrenheit _ 32)) _ 273Demonstrate the Temperature class by writing a separate program that asks the user for aFahrenheit temperature. The program should create an instance of the Temperature class, with the value entered by the user passed to the constructor. The program should then callthe object’s methods to display the temperature in Celsius and Kelvin. USING BLUE J PROVIDE TWO SOURCE CODE SHOWING RELATIONSHIP OF THE CODE AND OUTPUT. ONE CODE WITH TEMPERATURE AND OTHER WITH TEMPERATUREDEMO. IN TOTAL, YOU SHOULD SUBMIT 6 SOURCE CODE EACH HAS TWO SOURCE CODE. BELOW IS THE SAMPLE OF HOW SHOULD LOOKpublic class HelloWorldDemo{public static void main(String [] args) {HelloWorld myMessage = new HelloWorld();System. out. println(myMessage. getMessage());}}public class HelloWorld{private final String MSG="Hello World";public String getMessage(){return MSG;}}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 02:30, talia43
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
image
Computers and Technology, 24.06.2019 13:10, Briannas5022
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
image
Computers and Technology, 24.06.2019 14:30, yeet74
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
image
Computers and Technology, 25.06.2019 00:00, Ryan02717
Into which of these files would you paste copied information to create an integrated document? a. mailing list b. destination c. source d. data source
Answers: 1
You know the right answer?
Write a Temperature class that will hold a temperature in Fahrenheit and provide methodsto get the t...

Questions in other subjects:

Konu
Mathematics, 06.02.2020 01:43