Question: The method convertLength ( 0 has an integer parameter. Define a second convertLength ( ) method that has two integer parameters. The first parameter is
The method convertLength has an integer parameter. Define a second convertLength method that has two integer parameters. The first parameter is the number of kilometers and the second parameter is the number of meters. The method should retum the total number of meters.
Ex If the input is then the output is:
kilometers yields meters.
kilometers and meters yields meters.
Note: The total number of meters can be found using kilometers meters.
import java.utir.Scanner;
public class MethodoverloadTometers
public static int convertlengthint kilometers
return kilometers ;
vour code goes here
public static void mainstring args
scanner scnr new scanner
system.in;
int kilometersused;
int metersused;
int totalMeters;
int totalmeters;
kilometersused scnr nextInt ;
metersused scnr nextInt ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
