Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

By the end of the assignment, you will be able to: Write a Java program from scratch using selection, loops and methods. Use top-down

  

By the end of the assignment, you will be able to: Write a Java program from scratch using selection, loops and methods. Use top-down design to break down a large problem into much smaller solvable pieces. Preamble This program will accept commands from the user to draw a single filled-in rectangle within the positive Cartesian quadrant. The program should accept the (x,y) coordinate pair for the top left corner of the rectangle, along with the rectangle's width and height. After accepting the input, it should then draw the single rectangle on a 40 x 20 labelled grid. For example, if a rectangle has a top left corner of (15, 10) with a width of 4 and height of 7, then the program would display: 20 + 15+ 10+ **** **** **** **** **** 5 **** **** 0+ ==+== ==+====+> 0 5 10 15 20 25 30 35 40 Problem Statement 1. Design, by writing an algorithm, and test a solution to the above problem. You may discuss and work together to develop an algorithm - I encourage it. 2. Now use Java to implement your algorithm. This is to be done individually. Hints Top-down design is important in this assignment. Design each method carefully and what it should do- remember functional cohesion, coupling and procedural abstraction. LANGARA COLLEGE COMPUTER SCIENCE 1150 Once you write something on the screen you cannot "back up"; that is, once anything is outputted to the screen you cannot go to the left or up, you can only go down or to the right. You will need to validate all user input - that is, test all input to make sure they are acceptable. For instance, the rectangle must fit on the grid. What does that imply about the top left corner? The width and height? Provide error messages for erroneous inputs and then permit the user to try again. . . Use constants where appropriate (minimum and maximum X values, etc.) and base the rest of your code off these constants. Methods are useful friends; make them; use them. Methods can return at most one value to you. Documentation (program header comments and method comments) is also necessary. Remember to use Javadoc format for your comments. Arrays are not helpful for this assignment; please don't use them. I don't want to give penalty marks. What to Hand in Submit a single zip file to Brightspace before the due date containing: . Source code (*.java) of your final program after all the modifications have been made. Be sure that the comments and printIdentification method contain your name, student number, and course and section numbers. Remember to include instructions. Output listings (*.txt) from running your program showing that it works on multiple test cases. Mark Allocation OUT OF CRITERIA Style 112 /1 /1 /2 Whitespace, brace placement, etc. Good identifiers Method/program Javadoc style documentation Source Code /3 /1 /1 131161 /1 /6 /1 /3 /-5 /20 Use of constants Input validation and error messages Loops for each axis and its labels Good use of method parameters Nice cohesive methods Top-down design Sample Output Nicely labelled layout, multiple tests Deductions Total Class scoped variables (keyboard is okay) Using arrays for the grid or the rectangle 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Marketing And Export Management

Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr

8th Edition

1292016922, 978-1292016924

More Books

Students also viewed these Databases questions

Question

Calculate SE ( p ) for n=100 and the values of p given 16. p=.01

Answered: 1 week ago