27.8k views
3 votes
6.1.3: Function call with parameter: Printing formatted measurement. Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Ex: PrintFeetInchShort(5, 8) prints: 5' 8" Hint: Use \" to print a double quote.

User Clofresh
by
7.9k points

1 Answer

4 votes

Answer:

public class Main

{

public static void main(String[] args) {

PrintFeetInchShort(5, 8);

}

public static void PrintFeetInchShort(int numFeet, int numInches) {

System.out.println(numFeet + "'" + " " + numInches + "\"");

}

}

Step-by-step explanation:

Create a function called PrintFeetInchShort that takes two parameters, numFeet, and numInches

Print the given values in required format. Use System.out.println to print the values, ends with a new line.

Inside the main, call the function with two integers as seen in the example

User Aleksei Averchenko
by
8.1k points