1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
babunello [35]
3 years ago
14

Write a Temperature class that will hold a temperature in Fahrenheit and provide methodsto get the temperature in Fahrenheit, Ce

lsius, 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;}}
Computers and Technology
1 answer:
julsineya [31]3 years ago
5 0

Answer: Thermometer

Explanation:

You might be interested in
a. displays the sum of all even numbers between 2 and 100 (inclusive). b. displays the sum of all squares between 1 and 100 (inc
LuckyWell [14K]

Answer:

The program required is in the explanation segment.

Explanation:

Program :

import math

# a. displays the sum of all even numbers between 2 and 100 (inclusive).

print("All even numbers from 2 to 100 inclusive ")

sum=0

i=2

while i<=100:

if i %2 ==0:

sum=sum+i

print(i,end=" ")

i=i+1

print("\nThe sum of all even numbers between 2 and 100 (inclusive) :",sum);

#b. displays the sum of all squares between 1 and 100 (inclusive).

print("\nAll squares numbers from 1 to 100 inclusive:")

i=1

sum=0

while i<=100:

print(i*i,end=" ")

i=i+1

sum=sum+(i*i)

print("\n\nThe sum of all squares between 1 and 100 (inclusive) is :",sum)

#c. displays the powers of 2 from 1 up to 256.

print("\nAll powers of 2 from 2 ** 0 to 2 ** 8:")

i=0

while True:

p=math.pow(2,i)

if p>256:

break

print("2 ** ",i," is ",int(p))

i=i+1

#d. displays the sum of all odd numbers between a and b (inclusive), where a and b are inputs

print("\nCompute the sum of all odd integers between two intgers ")

a=int(input("Enter an integer:"))

b=int(input("Enter another integer: "))

count = 0

temp=a

sum=0

while a<=b:

if a%2!=0:

print(a,end=" ")

sum=sum+a

a=a+1

print("\nThe total of the odd numbers from ", temp ," to ", b ,"is",sum)

#e.displays the sum of all odd digits of an input. (For example, if the input is 32677, the sum would be 3 + 7 + 7 = 17.)

print("\nCompute the sum of the odd digits in an integer ")

n=int(input("Enter an integer:"))

count=0

sum=0

temp=n

while n!=0:

rem = n%10

if rem%2!=0:

sum=sum+rem

count=count+1

n=int(n/10)

print("Sum of the odd digits is ",sum)

print("The total of the odd digits in ",temp," is ",count)

4 0
3 years ago
Flesh out the body of the print_seconds function so that it prints the total amount of seconds given the hours, minutes, and sec
fiasKO [112]

Answer:

Step by step explanation along with code and output is provided below

Explanation:

#include<iostream>

using namespace std;

// print_seconds function that takes three input arguments hours, mints, and seconds. There are 60*60=3600 seconds in one hour and 60 seconds in a minute. Total seconds will be addition of these three  

void print_seconds(int hours, int mints, int seconds)

{

   int total_seconds= hours*3600 + mints*60 + seconds;

   cout<<"Total seconds are: "<<total_seconds<<endl;

}

// test code

// user inputs hours, minutes and seconds and can also leave any of them by  entering 0 that will not effect the program. Then function print_seconds is called to calculate and print the total seconds.

int main()

{

   int h,m,s;

   cout<<"enter hours if any or enter 0"<<endl;

   cin>>h;

   cout<<"enter mints if any or enter 0"<<endl;

   cin>>m;

   cout<<"enter seconds if any or enter 0"<<endl;

   cin>>s;

   print_seconds(h,m,s);

  return 0;

}

Output:

enter hours if any or enter 0

2

enter mints if any or enter 0

25

enter seconds if any or enter 0

10

Total seconds are: 8710

8 0
3 years ago
Which service uses a broadband connection?
Sidana [21]

Answer:

d

Explanation:

because all in one question form

5 0
3 years ago
Wite 3 names of computers used in 1st generation of computers?
enyata [817]
Here are some of the computers used in the first generation of computers:
ENIAC
EDVAC
UNIVAC
IBM-701
IBM-650
These are some of the first computers ever that led to today's computers.
5 0
2 years ago
In attempts to improve their contribution to the environment, a company decided to adapt to green computing. Which of these tech
timama [110]

Answer:

All of them apply

Explanation:

Green computing is the process of using environmental friendly computers and its associated components, accessories and other supporting devices.

Virtualization helps us to reduce the number of hardware that we are using.

Grid computers helps us to reduce the use of number of machines and thus supporting the environment in a right way.

Recycling process. Any material that we use needs to be recycled effectively and also in an environmental friendly way.

Autonomic computing uses eco-friendly system which in turn hugely support green computing.

8 0
2 years ago
Other questions:
  • How would Microsoft Word inform you of the error in the sentence below? (Tip: The error is in bold.)
    7·1 answer
  • A device (or a software program on a computer) that can monitor data traveling on a network is known as a socket sniffer. ______
    15·1 answer
  • A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
    15·2 answers
  • What key should you press and hold to select and open multiple files at one time? Enter Alt Control Esc
    12·2 answers
  • The spreadsheet below shows a list of fruits with their calorie count, grams of sugar, dietary fiber, and protein. Which set of
    8·1 answer
  • Write a program to generate a square wave with 80% duty cycle on bit P2.7 Microprocessor.​
    7·1 answer
  • Create html code showing heading tags​
    6·1 answer
  • 4.2 lesson practice last one plzs help
    5·2 answers
  • Consider the following code segment.
    5·1 answer
  • Assume that an int variable age has been declared and already given a value. Assume further that the user has just been presente
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!