By the end of the assignment, you will be able to: Write a Java program from...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these databases questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
MUST BE CORRECT ANSWERS A small software company has the following simplified cashflow, funded by shareholders' equity of 20,000 and a bank overdraft of 5000: Invoiced money received 2 months after...
-
You expect that Bean Enterprises will have earnings per share of $3 for the coming year. Bean plans to retain all of its earnings for the next three years. For the subsequent two years, the firm...
-
a. Use the following values and five-digit rounding arithmetic to construct the Hermite interpolating polynomial to approximate sin 0.34. b. Determine an error bound for the approximation in part...
-
If you could buy an investment now and four years later sell it for $27,000, what would you be willing to buy it for, assuming a 5% discount rate and no other cash flows?
-
If the allowable bearing stress for the plates under the supports at A and B is ( b ) allow =1.8 MPa, determine the maximum load P that can be applied to the beam. The plates A and B have square...
-
Great Lakes Pharmaceuticals, Inc. (GLPI), produces both prescription and over-the-counter medications. In January, GLPI introduced a new prescription drug, Capestan, to relieve the pain of arthritis....
-
Calculate the power expended doing 100 J of work in 50 s ?
-
1. How do race and ethnicity differ? How do discrimination and prejudice differ? Give examples. 2. Do you consider yourself defined more strongly by your race or by your ethnicity? How so? 3....
-
Nominal GDP Real GDP 2000 9817 9817 2001 10128 9890 2002 10470 10049 2003 10971 10321 2004 11734 10756 Nominal and Real GDP values are in billions of dollars a) Year 2000 is the based year. Find the...
-
Who is generally responsible for providing the accounting department with information n on financing and investment activities n to create the appropriate journal entries in the general ledger?
-
papers. For the first part a summarize in a paragraph psychological knowledge The second part of the pa limitations of the field of p please discuss the follow
-
Globalization demands a single set of high quality international accounting standards. List the elements of High Quality Standards and explain the two major boards that sets standards.
-
https://www.youtube.com/watch?v=wRNiPSenS_M&ab_channel=TheMacquarieUniversityCommunity Advise us on the labour laws and industrial relations system in France please.
-
What are the steps in the performance appraisal process?
-
Should U.S. antidumping laws be stated in terms of average total costs or average variable costs?
-
Can you list five pitfalls of this pattern, if any?
-
Can you compare this stable pattern with the one that is designed by using a traditional method?
-
What are some of the industrial applications of this pattern? Consider the practical aspects of usage.
Study smarter with the SolutionInn App