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
Annette [7]
3 years ago
5

Write a Temperature class that will hold a temperature in Fahrenheit, and will provide methods to get and display the temperatur

e in Fahrenheit, Celsius, and Kelvin. The Temperature class should have the following instance variable: ftemp – A double that holds a Fahrenheit temperature. The Temperature class should have the following methods: ReadInput – Uses a Scanner method to populate ftemp with double value. getFahrenheit – Returns the value of the ftemp field, as a Fahrenheit temperature. getCelsius – Returns the value of the ftemp field converted to Celsius. getKelvin – Returns the value of the ftemp field converted to Kelvin. DisplayOutput – The Fahrenheit temperature and the equivalent values in Celsius and Kelvin are gotten and displayed, one per line, and each along with an appropriate message.
Computers and Technology
1 answer:
natita [175]3 years ago
8 0

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class TemperatureTest {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter Fahrenheit temperature: ");

double ftemp = sc.nextDouble();

Temperature temp = new Temperature(ftemp);

System.out.println("The temperature in Fahrenheit is " + temp.getFahrenheit());

System.out.println("The temperature in Celsius is " + temp.getCelsius());

System.out.println("The temperature in Kelvin is " + temp.getKelvin());

}

}

class Temperature {

double ftemp;

Temperature(double ftemp) {

this.ftemp = ftemp;

}

double getFahrenheit(){

return ftemp;

}

double getCelsius(){

return ((double)5/9*(ftemp-32));

}

double getKelvin(){

return (((double)5/9*(ftemp-32))+273);

}

}

Output:

$ java TemperatureTest

Enter Fahrenheit temperature: -40

The temperature in Fahrenheit is -40.0

The temperature in Celsius is -40.0

The temperature in Kelvin is 233.0

You might be interested in
You’ve received a tarball called data79.tar from a colleague, but you want to check the names of the files it contains before ex
Nina [5.8K]

Answer:

D. tar rvf data79.tar

4 0
2 years ago
Many programmers think object-oriented programming is a superior approach to procedural programming. Others think it adds a leve
fgiga [73]

I agree with the programmers who think object-oriented programming is a superior approach to procedural programming.

<h3>Why is OOP better than procedural programming?</h3>

In terms of Security, Object-oriented programming is said to have more of a secure based than procedural programming, due to the level of abstraction or that is due to data hiding property.

Note that  It hinders the access of data to any member functions of the same class and one cannot see a thing like that such as data hiding in the procedural programming framework.

Learn more about object-oriented programming  from

brainly.com/question/12342989

#SPJ1

4 0
1 year ago
Engineers involved in product design and manufacturing use computer-aided design/computer-aided manufacturing (CAD/CAM) systems,
stepan [7]

Engineers who are involved in product design and manufacture of computer-aided should have enough knowledge in circuit and auto cad electronic design.

<u>Explanation:</u>

He or she should have mother board, voltage in or out extra. Person who develops should enough knowledge on circuit design which capacitor, resistance and voltage and processor capacity.

Each design they have first simulates and tested and result should be recorded. On simulation test success design is made.

There is third party software also available for design the circuit and gives the tested results as report.

6 0
3 years ago
Cindy tried to delete a customer but the customer still had open invoices so the system would not allow her to delete the custom
Verdich [7]

Answer:

The answer is "Referential integrity".

Explanation:

This relates to one aspect of data integrity. Data across multiple tables are linked via relationships. In view of the distinct customer & invoice tables, each invoice table should have the primary key specified throughout the Customer table, for instance. Whenever the invoice table contains a customer ID reference. This ID including its customer will be only a table of the customer.

8 0
3 years ago
Write a method called all Less that accepts two arrays of integers and returns true if each element in the first array is less t
GaryK [48]

Answer:

The program to this question can be given as:

Program:

#include<iostream> //header file

using namespace std; //using name space

bool allLess (int arr1[], int arr2[]) //defining method allLess  

{

int a,b; //define variable

a=  *(&arr1 + 1) - arr1; //hold length of arr1

b=  *(&arr2 + 1) - arr2; //hold length of arr2

if(a!=b) //checking condition  

{

return 1; //return value

}

for(int i=0; i<a; i++) //loop

{

if( arr1[i]>=arr2[i]) //checking condition

{

return 1; //return value

}

}

return 0; //return value

}

int main() //define main method.

{

   int arr1[]={1,2,3,4,5}; //define array arr1 and assign value.

   int arr2[]={4,5,6,7,8}; //define array arr2 and assign value.

   cout<< allLess(arr1,arr2); //function calling

   return 0;

}

Output:

1

Explanation:

The Explanation of the C++ language program can be given as follows:

  • In the above program firstly we include the header file. Then a method is defined that is "allLess" this method accepts two arrays that are "arr1 and arr2". This function returns a boolean value that is true or false.
  • Inside a function, we define a conditional statement and a loop in the if block we check the length of the arr1 array variable is not equal to arr2 array length. if this condition is true it will return false.
  • In the loop, we define another if block in this block we check that if arr1 array elements are grater then equal to arr2 array element if this condition is true it will return false. At the end of both if block and loop the function will return a value that is "true".
  • In the main method, we define two arrays and pass to the function and use (cout function) for print return value.
8 0
3 years ago
Other questions:
  • The word computer consists of 64 bits, which is equivalent to _____ bytes.
    5·1 answer
  • Which of the following is a sigh that your computer may have been infected with malicious code
    12·1 answer
  • Explique si en la pc que se usa para hacer las tareas escolares se puede ver un video juego de los llamados “pesados”
    13·1 answer
  • How do you ask brainy a question without it not liking the question and saying it hurts their feelings?
    14·1 answer
  • A computer can sort x objects in t seconds, as modeled by the function below:
    5·1 answer
  • Discuss the different types of user-friendly interfaces and the types of users who typically use each.
    12·1 answer
  • Computer privacy typically occurs when which of the following is violated?
    6·1 answer
  • In addition to ranking the relevance of a particular site according to the keywords entered by the user, which of the following
    10·1 answer
  • PLZZZZZZZZZZZZZZZ HELP ME OUT!!!!! I SICK AND TIRED OF PEOPLE SKIPING MYQUESTION WHICH IS DUE TODAY!!!!
    14·1 answer
  • Retail products are identified by their Universal Product Codes (UPCs). The most commonform of a UPC has 12 decimal digits: The
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!