Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your solution must meet the following criteria: Block comments for each method Line comments Indentation Proper naming Methods Output must be the same as the

Your solution must meet the following criteria:

Block comments for each method

Line comments

Indentation

Proper naming

Methods

Output must be the same as the provided output including all the spaces.

Problem: Write a program to convert meters to feet and vice versa. Your program must include the following methods:

Public static double feetToMeter(double foot): This method converts the foot amount into meter and returns the result as a double.

Public static double feetToInches(double foot): this method gets a double value representing feet and returns a double value representing the inches amount in feet.

Public static double meterToCenti(double meter): this methods get the parameter as the meter unit ,converts it to centimeter and returns it.

Public static double centiToMilli(double centi): this method gets the parameter as centimeter and converts it to millimeter and returns it.

Write a method that outputs the following by calling the methods in part 1 and part2. In this method you must use just one for loop. You also must use printf in order to format your output to just two decimal points.

Here is the formulas for conversions: a. 1 foot is .305 meter.

b. 1 foot is 12 inches c. 1 meter is 100 centimeter d. 1 meter is 1000 millimeter e. 1 centimeter is 10 millimeter.

Write the main method so that it calls the methods in the step 3 to produce the output that is provided in the file output.txt.

output in Java:

------------------------------------------------------ Feet Inch Meter Centimeter Millimeter 1 12.00 0.31 30.50 305.00 2 24.00 0.61 61.00 610.00 3 36.00 0.92 91.50 915.00 4 48.00 1.22 122.00 1220.00 5 60.00 1.53 152.50 1525.00 6 72.00 1.83 183.00 1830.00 7 84.00 2.14 213.50 2135.00 8 96.00 2.44 244.00 2440.00 9 108.00 2.75 274.50 2745.00 10 120.00 3.05 305.00 3050.00 11 132.00 3.36 335.50 3355.00 12 144.00 3.66 366.00 3660.00 13 156.00 3.97 396.50 3965.00 14 168.00 4.27 427.00 4270.00 15 180.00 4.58 457.50 4575.00 16 192.00 4.88 488.00 4880.00 17 204.00 5.19 518.50 5185.00 18 216.00 5.49 549.00 5490.00 19 228.00 5.80 579.50 5795.00 20 240.00 6.10 610.00 6100.00 -----------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

It can place a financial burden on families and the public.

Answered: 1 week ago