Pledged Lab QuizThis lab quiz is pledged. You may use your textbook, and NOTHING ELSE. This includes any files in your home directory, previous assignments, slides, etc. However, you should still save your file into your home directory. You will need to submit a single file called LabQuiz1.java. You may download the skeleton code here: LabQuiz1.java. You must also save the Rectangle.class file to the same directory that your LabQuiz1.java file is in. For both files, right click on the link and select "save as" (or "save target as"). The TAs cannot help you with Java-related issues on this quiz. If you are having problems getting JCreator to work, can't log in to the machines, etc., then you are welcome to ask the TAs for assistance. If you do not understand what the lab is asking, the TAs may be able to help you (meaning if it's a problem with our explanation, then they can help you -- if you've been skipping the lectures so far and have no idea what any of this means, you are on your own). If you get an error in JCreator that states, "cannot find symbol class Rectangle", then you have not saved the Rectangle.class file properly. You may as a TA to help fix this problem. Advice
Rectangle ClassFor this quiz, you will need to use the Rectangle class that was discussed in lecture, and also in the textbook (chapter 3, pages 109-114). The relevant methods are as follows.
Lab QuizTo get full credit on this quiz, your code must complete the following eight steps:
For testing your code, it will be easier to use "small" values (i.e. less than 10). If your rectangle is too big, or too far from the origin, then it will not display correctly. How to ProceedGet the steps working in order! Make sure step 1 works before you move onto step 2. If you don't follow this, you will end up with a mess of code that doesn't work, and you will not be able to fix it within the lab quiz time. There will be partial credit given for this lab quiz -- so if you only get steps 1-6 working, you will get a good amount of points. But if you have a large mess of code that doesn't work, you will get very few points. Sample outputBelow is a sample run of the program. The text in red is what was input by the user. The text in green is optional (prompts, legends, and such) -- add it only if you have sufficient time. Rectangle manipulation Enter four values for the rectangle: x, y, width, and height 5 10 5 10 +--------------------------------------------------------------------------+ | | | | | | | | | | | | | | | | | | | | | +--------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +--------+ | | | +--------------------------------------------------------------------------+ Enter two more integer values 2 5 Rectangle at 2, 5: +--------------------------------------------------------------------------+ | | | | | | | | | | | +--------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +--------+ | | | | | | | | | | | | | +--------------------------------------------------------------------------+ Rectangle grown by 2, 5: +--------------------------------------------------------------------------+ | | | | | | | | | | | +------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +------------+ | | | +--------------------------------------------------------------------------+ Other RequirementsYou are only required to follow a few of the good programming practices discussed in HW J1. If you have time, feel free to do the others -- but due to the time constraints of the quiz, you don't have to do them all. The ones you must do are listed below.
SubmissionWhen you are finished, submit your LabQuiz1.java file. You will have to "sign" a pledge on the submission.
|