Question: In java why do I need to add a return centimeters;? My professor Didn't explain at all and ignored me lol. Here's the code: public

In java why do I need to add a return centimeters;? My professor Didn't explain at all and ignored me lol.

Here's the code:

public class ha { public static double calcFeetAndInchesToCentimeteres(double feet, double inches) { if((feet < 0 || ((inches <0) && (inches >12)))) { return -1; } double centimeters = (feet*12) * 2.54; centimeters += inches * 2.54; System.out.println("feet" + feet + inches + centimeters); return centimeters; } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!