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]
3 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]3 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
What is the primary purpose of the destination address?
ehidna [41]

Answer:

The answer to this question is given below is the explanation section.

Explanation:

"A" option is correct

    It helps the router know where to send the packet.

4 0
3 years ago
If the transmitting device would like for the receiving device to push currently buffered data to the application on the receivi
Andreyy89

Answer:

The right approach will be "PSH".

Explanation:

  • The PSH flag seems to be an acceptable solution through TCP which always encourages the submit implementation to immediately transfer data but only whenever the buffer isn't complete.
  • The implementation helps to formulate this same flag towards true for something like the connection, as well as TCP will instantly begin transmitting the relevant information.
3 0
3 years ago
Write a program to prompt the user to enter a fist name, last name, student ID and GPA. Create a dictionary called Student1 with
andrew-mc [135]

Answer:

Answered below

Explanation:

#Program is written in Python

first_name = input ("Enter first name: ")

last_name = input ("Enter last name:")

student_id = int(input("Enter your ID"))

gpa = float(input ("Enter your GPA: "))

student1 = {}

student1["first_name"] = first_name

student1["last_name"] = last_name

student1["student_id"] = student_id

student1["gpa"] = gpa

//Repeat same code for student2 and student3

class_list = {"student1": {"first_name":"joy","last_name":"Son","student_id":"1","gpa":"3.5"},

#Fill in for student 2 and 3}

#To remove GPA for all students

del class_list["student1"]["gpa"]

del class_list["student2"]["gpa"]

del class_list["student3"]["gpa"]

print(class_list)

4 0
3 years ago
Naomi wants to search for online courses on web development she types this term in the address bar which browser allows her to u
natka813 [3]
Google Chrome browser
4 0
4 years ago
What happens once the Insert tab is used in PowerPoint to insert a chart into a presentation?
DochEvi [55]

Answer:

A (because you can't have a chart without information, right?)

brainliest plz

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • What is PHP language
    12·1 answer
  • How has the development of personal computer hardware and software reversed some of the trends brought on by the industrial revo
    15·1 answer
  • What is the output of the following code snippet? double income = 45000; double cutoff = 55000; double minIncome = 30000; if (mi
    14·1 answer
  • Where is authorization management app on tablet?
    7·1 answer
  • Calculate the weighted grade for each student that appears in the data file. You may calculate the grade based on total earned p
    13·1 answer
  • Assuming that each of the resistors in the circuit shown in the figure above has a resistance value of 100 k ohms, what will be
    11·2 answers
  • Google Glass uses a projector that bounces a beam of light off a prism and projects the image directly on your ________. field o
    14·1 answer
  • Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smalle
    11·1 answer
  • 1. an image can be stored either in a vector graphic file or in a bitmap file true or false
    12·1 answer
  • Diane, a developer, needs to program a logic component that will allow the user to enter a series of values
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!