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
zavuch27 [327]
3 years ago
7

Implement the following integer methods:

Engineering
1 answer:
padilas [110]3 years ago
7 0

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        System.out.print("Choose an option 1) Convert Fahrenheit to Celcius  2) Convert Celcius to Fahrenheit: ");
  6.        int option = input.nextInt();
  7.        if(option == 1){
  8.            System.out.print("Please enter a temperature in Fahrenheit: ");
  9.            double fahrenheit = input.nextDouble();
  10.            System.out.println("The equavalent Celcius is: " + Celsius(fahrenheit));
  11.        }
  12.        else if(option == 2){
  13.            System.out.print("Please enter a temperature in Celcius: ");
  14.            double celcius = input.nextDouble();
  15.            System.out.println("The equavalent Fahrenheit is: " + Fahrenheit(celcius));
  16.        }
  17.        else{
  18.            System.out.println("Invalid option.");
  19.        }
  20.    }
  21.    public static double Celsius(double fahrenheit){
  22.        return 5.0/ 9.0 * (fahrenheit - 32);
  23.    }
  24.    public static double Fahrenheit(double celcius){
  25.        return 9.0 / 5.0 * (celcius + 32);
  26.    }
  27. }

Explanation:

Firstly, import the Scanner class as we need to prompt user to choose an option to display the temperature value (Line 1).

Next we create a method Celcius that will take one input fahrenheit and then apply the formula to calculate and return the equivalent Celsius (Line 24 - 26).

Create another method Fahrenheit that will take one input celcius and then apply the formula to calculate and return the equivalent Fahrenheit (Line 28 - 30).

In the main program, use the scanner object to get user input the option to display temperature value (Line 5- 7).

Create an in-else-if block and check if the option is one, get an input Fahrenheit from user and call the Celsius method to display the equivalent temperature in Celsius (Line 9 -13).

If the option is two, get an input Celsius from user and call the Fahrenheit method to display the equivalent temperature in Fahrenheit (Line 14 -18).

If the input option is other than 1 or 2, display an error message (Line 19 - 21)

You might be interested in
Fill in the blank to correctly complete the statement below.
frutty [35]

Answer:

The invention of the pendulum-driven ___<u>clocks</u>___ in the 1600s paved the way for a new industrial era.

4 0
4 years ago
An 1800-W toaster, a 1400-W electric frying pan, and a 75-W lamp are plugged into the same outlet in a 15-A, 120-V circuit. The
Mila [183]

Answer:

a) Current drawn by the toaster = 15A

Current drawn by the electric frying pan = 11.67A

Current drawn by the lamp = 0.625A

b) This combination will blow the 15A fuse as the total current requirement for this setup exceeds the 15A rating of the fuse.

Explanation:

a) For parallel connection, there exists, the same voltage and different currents across all the devices.

Voltage cross each of the 3 devices = outlet voltage of 120V

From their respective power rating, current drawn by each device will be calculated.

P = IV

For the toaster, P = 1800 W, V = 120V

I = 1800/120 = 15A

For the electric frying pan, P = 1400 W, V = 120 V

I = 1400/120 = 11.67 A

For the lamp, P = 75 W, V = 120V

I = 75/120 = 0.625 A

b) Total current in a parallel connection setup = Sum total of all the currents.

Total current drawn by all 3 devices = 15 + 11.67 + 0.625 = 27.295A = 27.3 A

This total current requirement surpasses the 15A current rating of the fuse, therefore, this combination will blow the fuse.

Hope this Helps!!!

6 0
4 years ago
Why will screws never replace nails​
cupoosta [38]

Answer:

because people have different opinions on nails and screws

Explanation:

3 0
4 years ago
In a website browser address bar, what does “www” stand for?
Ludmilka [50]

Answer:

www stands for world wide web

Explanation:

It will really help you thank you.

3 0
3 years ago
please help me answer 3 of these questions in complete sentences. this is ccrd 1 related to jobs and college. thanks so much if
Kitty [74]

Answer:

1. Work is a driving force of identity in your life, whether its because it influences you due to the time spent there. Or its truly a passion of yours.

2. Two main aspects of identity development are self-concept and self-esteem

3. Based on you obviously

Hope this helped!

Explanation:

5 0
3 years ago
Other questions:
  • I need solution for this question please ​
    7·2 answers
  • Anyone know sebastian from bb
    8·1 answer
  • Adore.aaliyah_ add me loves !
    7·1 answer
  • On a given day, a barometer at the base of the Washington Monument reads 29.97 in. of mercury. What would the barometer reading
    6·1 answer
  • Define Viscosity. What are the main differences between viscous and inviscid flows?
    10·1 answer
  • Select the correct answer.
    6·1 answer
  • Ordan has _ 5 8 can of green paint and _ 3 6 can of blue paint. If the cans are the same size, does Jordan have more green paint
    15·1 answer
  • What is a beam on a bridge? what does it do?
    6·1 answer
  • What is considered the greatest engineering achievement of the 20th century?
    10·1 answer
  • Reason fo I.EE regulations in electrical installations​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!