Ask Question
12 September, 22:25

Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Ex: printFeetInchShort (5, 8) prints:

+4
Answers (1)
  1. 13 September, 00:36
    0
    Complete Question:

    Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: printFeetInchShort (5, 8) prints:

    5' 8"

    Hint: Use / " to print a double quote.

    Answer:

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

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

    }

    Explanation:

    The main idea here is the use of escape sequence to format our output the way we want it. A complete code is given below that calls this method and displays the output as required

    public class NewQues {

    public static void main (String[] args) {

    int numFeet;

    int numInches;

    printFeetInchShort (5, 8);

    System. out. println ("");

    return;

    }

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

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

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Ex: ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers