Question: Can you please do this in Java? Defining a new method named drawHouse, and calling this method from main. Your new method drawHouse draws the
Can you please do this in Java? Defining a new method named drawHouse, and calling this method from main. Your new method drawHouse draws the house by invoking (calling) the given methods to draw a cone. Also Pass an additional parameter to the method drawRocket() that stores the country as a 2 character String (e.g. "US") and includes the specified country on the rocket. Draw 2 rockets, one with "US" and another with "RU", by having your main method call the same drawRocket() method twice. public class DrawFiguresUpdated { // Draw figures. public static void main (String[] args) { drawDiamond(); // calling a method drawDiamond defined in the same class System.out.println (); drawX(); // calling a method drawX defined in the same class System.out.println (); // Draw 2 rockets, by calling the same method twice. // We are passing a String as a parameter to the drawRocket method. drawRocket(" "); drawRocket("This is a rocket"); } // end main // Draw a diamond. public static void drawDiamond() { drawCone(); drawV(); } // Draw an X. public static void drawX() { drawV(); drawCone(); } // Draw a rocket. // Parameter: extra, a String storing something extra to print after drawing the rocket. public static void drawRocket(String extra) { drawCone(); drawBox(); System.out.println ("| US |"); drawBox(); drawCone(); System.out.println(extra); // Print extra (a String received from calling method) } // Draw a cone. public static void drawCone() { System.out.println (" /\\ "); System.out.println (" / \\"); } // Draw a V. public static void drawV() { System.out.println (" \\ /"); System.out.println (" \\/ "); } // Draw a box. public static void drawBox() { System.out.println ("+----+"); System.out.println ("| |"); System.out.println ("| |"); System.out.println ("+----+"); } } // end DrawFigs
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
