Question
Primary Shapes For this project, create a Java program that includes a class that holds the main method and the following methods. The module topic
Primary Shapes
For this project, create a Java program that includes a class that holds the main method and the following methods. The module topic Hello World ModularizedLinks to an external site. demonstrates this approach. Here are the methods that are required. You must use these method names:
drawHorizontalLine: This method will display a horizontal line using asterisks
drawVerticalLine: This method will display a vertical line using asterisks
drawRectangle: This method will display a rectangle using asterisks
drawSquare: This method will display a square using asterisks
drawUpTriangle: This method will display a triangle pointed up using asterisks
drawDownTriangle: This method will display a triangle pointed down using asterisks
The main method should display a label and call (activate) each method to display each shape. For example, the main method should display the label "Triangle", then call the drawTriangle method to display a triangle shape made of asterisks.
Important Note: The label should be in the main method only. If you put a label in the primary shape methods, it will cause problems with the complex shapes that you need to make next.
Complex Shapes
Next, the main method should display a label and call the methods again, but in a different order so the combined shapes make a more complex shape. You can call as many of these methods as you need, as many times as you need them, in any order to make complex shapes.
For example, to display a house, do not create a method that displays a house! Instead, first display the label "House" in the main method, then call drawUpTriangle and then call drawRectangle.
public static void main(String[] args) { System.out.println("House"); drawUpTriangle(); drawRectangle(); } }"C:\Program Files\JetBrains\Intelli) IDEA Community Edition 2019.3.1 Vertical Line * Up Triangle: * * * ********* Rectangle: * **** * * * * ********* Horizontal Line: ********* Square: * * Down Triangle: ********** * * Process finished with exit code o House: **
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started