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
You are using a Geiger counter to measure the activity of a radioactive substance over the course of several minutes. If the rea
Reika [66]

Answer: 33.35 minutes

Explanation:

A(t) = A(o) *(.5)^[t/(t1/2)]....equ1

Where

A(t) = geiger count after time t = 100

A(o) = initial geiger count = 400

(t1/2) = the half life of decay

t = time between geiger count = 66.7 minutes

Sub into equ 1

100=400(.5)^[66.7/(t1/2)

Equ becomes

.25= (.5)^[66.7/(t1/2)]

Take log of both sides

Log 0.25 = [66.7/(t1/2)] * log 0.5

66.7/(t1/2) = 2

(t1/2) = (66.7/2 ) = 33.35 minutes

4 0
3 years ago
Tech distractions do NOT include _________.
likoan [24]
D, setting phone BEFORE
7 0
4 years ago
I'm really bad at measurements so I don't understand this.
cricket20 [7]

Answer:

the answer should be 16

6 0
4 years ago
You have designed a treatment system for contaminant Z. The treatment system consists of a pipe that feeds into a CSTR. The pipe
IRISSAK [1]

Answer:

0.667 per day.

Explanation:

Our values here are

Q=10m^3/dV_p=15m^3\\V_{cstr}=60m^3\\c_p=2500mg/L\\c_{cstr}=500mg/L

Degradation constant=k and is unknown.

We calculate the concentration through the formula,

cc_{cstr} =\frac{c_{in}}{1+K(V/Q)} \\cc_{cstr}=\frac{c_p}{1+K*\frac{V_{csrt}}{Q}}

Replacing values we have

1+k(\frac{60}{10})=\frac{2500}{500}\\1+k=5\\K(6)=5-1\\K(6)=4\\K=2/3\\K=0.667/day

That is the degradation constant of Z-contaminant

3 0
3 years ago
Which of the following is not a conductor of electricity.
Usimov [2.4K]

Answer:

Rubber

Explanation:

Rubber is not a conductor of electricity

4 0
4 years ago
Read 2 more answers
Other questions:
  • A driver traveling at 65 mi/h rounds a curve on a level grade to see a truck overturned across the roadway at a distance of 350
    13·1 answer
  • A spacecraft starts in elliptical orbit JK (red solid curve) around some planet and transfers to elliptical orbit MN (blue solid
    7·1 answer
  • for an electromotive force to be induced across a vertical loop from the field of an infinite length line of fixed current in th
    6·1 answer
  • What are the basic parts of a radio system
    15·1 answer
  • Describe what a dislocation is, and how it is important in the plastic deformation of materials
    14·1 answer
  • I have a resistor connected to a power supply that delivers a fixed voltage for any current (up to some maximum current). With a
    8·1 answer
  • What is an air mass?​
    5·2 answers
  • What kinds of problems or projects would a civil engineer work on?
    14·1 answer
  • Rigid bar ACB is supported by an elastic cir-cular strut DC having an outer diameter of 15 in. and inner diameter of 14.4 in. Th
    10·1 answer
  • Calculate the magnitude of the resultant force F⃗ r=F⃗ 1+F⃗ 2+F⃗ 3 acting on the block.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!