Question
IN JAVA public class CopGeometryArt { /** * Draws a rectangle with a base and height * @param int base * @param int height */
IN JAVA
public class CopGeometryArt { /** * Draws a rectangle with a base and height * @param int base * @param int height */ public static void createRectangle(int base, int height) { // TODO }
/** * Draws a Triangle with the leg length * @param int leg */ public static void createTriangle(int leg) { // TODO }
public static void main(String[] args) { // The following are different test cases that // must work with your methods above // Methods cannot be hardcoded but instead work // correctly with any of the parameter values below // or if I slightly change the values // You may assume the min value for any dimension // I will use is 1, and the max is 10 createRectangle(10, 9); // test case 1 System.out.println();
createTriangle(10); // test case 2 System.out.println();
createTriangle(1); // test case 3 System.out.println();
createRectangle(1, 1); //test case 4 System.out.println();
createTriangle(4); // test case 5 System.out.println();
createRectangle(4, 3); // test case 6 System.out.println();
createRectangle(3, 4); // test case 7 }
}
For this assignment, the main code with test cases is provided and you have to complete (write the code for) two methods. Rather than submitting a zip this time, you must submit BOTH of the items below: 1. a txt file with the two methods' code ONLY (if you include any other code e.g. class or main there might points off) Please do not submit a screenshot of the code, we must be able to copy/paste your code into an IDE 2. a screenshot or two of the output. (jpg,jpeg, png) Grading Please note that the following counts towards your grade - your submitted code must: 1. Include comments (as in example code on Canvas and in textbook) and follow standard formatting (as shown in class and in the book); 2. Compile and run without errors; 3. Produce the output per instructions; 4. Use the Java concepts and structures per the instructions, e.g. methods, loops, etc.; overcomplicated logic or code that could be written in a simpler/more straightforward/more efficient/etc. way will likely result in points off. Task In this assignment inspired by the Oracle Academy, you'll find a way to draw basic shapes programmatically in customizable sizes. For example (you may use "*" or "#" for your shapes) : 5x4 Rectangle # # 5x5 Isosceles Right Triangle Given the assignment2 code on Canvas that contains the main() with several test cases: complete the following two methods: createRectangle(): This method accepts two arguments for width and height which should be used to print a rectangle create Triangle(): This method accepts one argument for the size of a leg, which should be used to print an isosceles right triangle You must not hardcode the shapes or any of the dimensions, but you may use loops, branching, etc. Do not use Arrays: they are not a part of this assignmentStep 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