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
ahrayia [7]
4 years ago
6

Write a program that contains the following two methods: /** Convert from feet to meters */ public static double footToMeter (do

uble foot) /** Convert from meters to feet */ public static double meterToFoot (double meter) The formula for the conversion is : meter

Computers and Technology
1 answer:
mixer [17]4 years ago
7 0
<h3><u>Complete Question:</u></h3>

Write a program that contains the following two methods:

/** Convert from feet to meters */

public static double footToMeter(double foot)

/** Convert from meters to feet */

public static double meterToFoot(double meter)

<em>The formula for the conversion is: meter = 0.305 * foot and foot = 3.279 * meter Write a test program that invokes these methods. PLEASE WRITE IN JAVA.</em>

<em />

<em />

<em />

<h3><u>Answer:</u></h3>

//Declare the class

public class Converter{

   

    //method footToMeter that receives the foot as parameter

    public static double footToMeter(double foot){

        //declare a double variable called meter,

        //to hold the result of the conversion

        double meter;

       

        //using the given formula, conver the foot to meter and

        //store the result in the meter variable

        meter = 0.305 * foot;

       

        //return the result stored in meter

        return meter;

    }

   

   

    //method meterToFoot that receives the meter as parameter

    public static double meterToFoot(double meter){

        //declare a double variable called foot,

        //to hold the result of the conversion

        double foot;

       

        //using the given formula, convert the meter to foot and

        //store the result in the foot variable.

        foot = 3.279 * meter;

       

        //return the result stored in foot.

        return foot;

    }

   

   

    //Test program to invoke those methods

    public static void main(String []args){

           

           //Convert 120 feet to meter

           System.out.println("120 feet to meter is " + footToMeter(120));

           

           //Convert 36 meters to foot

           System.out.println("36 meters to feet is " + meterToFoot(36));

    }

   

   

}  //End of class declaration

<h3><u>Sample Output:</u></h3>

120 feet to meter is 36.6

36 meters to feet is 118.044

<h3><u>Explanation</u>:</h3>

The above code has been written in Java and it contains comments explaining each line of the code. Please go through the comments.

There is also a sample output from the run of the code.

An screenshot containing the program and the output has also been attached to this response.

You might be interested in
7. Define ports including standard and<br>specialized ports. Give examples of each.​
Montano1993 [528]

Answer:

An example of a standard port is USB (universal serial bus) which connects several devices to the system unit. An example of a specialized port is Thunderbolt which is identified by Apple's MacBook Pro and provides a high-speed connection promising to replace a number of ports such as Mini Display port.

Explanation:

Please give brainlest

5 0
3 years ago
Which process refers to starting up a computer?<br> is the process of starting a computer.
Dennis_Churaev [7]

Answer: Boot Up or booting

Explanation:

6 0
4 years ago
Read 2 more answers
Determine whether the compound condition is True or False. 2&lt;3 and 5&lt;1.3&lt;3 and 1≤1. not (2==3). true false cannot be de
seraphim [82]

Answer:

False

Explanation:

The second bool operation results to false since 5 is not less than 1.3

5 0
3 years ago
Read 2 more answers
An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
erastovalidia [21]

2010s is the one who created the iPhone

8 0
3 years ago
List three tacos there are several from the opening page of the help and support center.
s344n2d4d5 [400]
Mexican tacos sascSDV
8 0
4 years ago
Other questions:
  • Which technology is the basis for XML?
    14·1 answer
  • What is TCP/IP's Transport layer's primary duty?
    8·1 answer
  • Which feature of a browser will you select to block pop-ups? view help tools file
    15·2 answers
  • How can you put a video on powerpoint?
    14·2 answers
  • When a crash results in property damages of any amount, the driver must notify:
    10·1 answer
  • Which of the following is true about radio waves? They have short wavelengths. They have high energies. They reveal hot gases. T
    10·2 answers
  • A supermarket chain wants you to implement an in-memory database that can be used to access facts about the products they sell.
    12·1 answer
  • Write, compile, and test a program named PersonalInfo that displays a person's name, birthdate, work phone number, and cell phon
    5·1 answer
  • Who here has a crush on jk from bts but feels more mature than him
    10·2 answers
  • How is an operating system like a translator?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!