CS1301 Project 3- Drawing Shapes Solved

35.00 $

Category:

Description

5/5 - (1 vote)

Write a program in Java that utilizes variables, assignments, expressions, inputs, outputs, decision statements, loops, nested loops, and various nested statements.

Design and implement an algorithm to solve a problem.

Apply knowledge of compiling, running, testing, and debugging a Java program.

Use good programming style and standards.

Introduction

In this project, we will demonstrate our knowledge of loops, decision statements, and nested statements to draw shapes. This project will consist of drawing rectangles, triangles, hexagons, octagons, and pentagons exactly as shown in the examples provided at the end of this document.

Your program should be in class called DrawingShapes and stored in a file called DrawingShapes.java.

Program Requirements

  1. You will need to comment each section of your source code that draws a shape. For example, you need to include comments for the section of source code that draws a rectangle, comments for the section of code that draws a triangle, and so forth for each shape required in this project.
  2. All instructions in this document must be followed in order for full credit to be awarded. Following the instructions is a vital part to this and all programming assignments.
  3. Your program must follow the examples provided in the Examples section, and your program’s I/O (input and output) must match the examples exactly (otherwise, points will be deducted). If your program does not produce the same output as our examples, then your program has a bug, and you’ll need to fix any bugs using any debugging techniques discussed this semester. There should be NO spaces to right of any *’s in your program’s output, and the number of spaces in front of the *’s do matter in order to output the shape correctly based on the examples. After drawing the last * in the shape, your program should print a single newline character.
  4. Your program must handle all error cases as shown in the examples. The valid shapes (r t h o p) are shown in the prompts in the examples, and any other input for shapes are considered as invalid. The user input for drawing an octagon is a lowercase o, the letter before p in the English alphabet.  A length is valid if and only if it is greater than 1, and a height is valid if and only if it is greater than 1.  Also, some shapes do not require height as an input, and these shapes should not prompt the user for a height.  Invalid inputs must be handled as shown in the examples.
  5. For all sets of valid user input, your program must correctly draw the shape and dimension(s).
  • project03-mx2yx0.zip