Ask Question
23 August, 04:40

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

+5
Answers (1)
  1. 23 August, 05:33
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers