CSC142 Project 2: Draw Curves from Straight Lines 1 Objective In this program you will use...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
CSC142 Project 2: Draw Curves from Straight Lines 1 Objective In this program you will use existing objects. You will also learn about and use graphics coordinates. 2 Input The only input comes from an argument to main(), used for Part 1. Pass in a string representing the desired size of the drawing panel (e.g., 400) which will help test the flexibility of your code. When running main in BlueJ, provide the argument this way, when asked: {"400"} In code, convert the parameter to an integer this way: Integer.parseInt(args[0]); int dpSize = No terminal/console output should be shown; only the graphics should appear. 3 Output 3.1 Part 1 Generate this graphic output shown above right, on a DrawingPanel of the size specified in the argument to main. Java Programming I 3.2 Barry Alter the colors to suit your taste (but use at least two different colors of lines on a non-white background). Set the increment between lines to something pleasing to the eye; it does not need to exactly match the sample. Create an integer constant called LINE_INCREMENT for this purpose. I should be able to change that to a different number (evenly divisible or not) and see the expected output. For descriptions of the technique and samples of output, see these sites: site1, site2. Part 2 Create an additional drawing panel at least 600 x 600. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors. Lines don't count as shapes, here. And black doesn't count as one of the two colors; be a bit more creative and colorful, please. Each shape type should be drawn by its own function (that you write) with parameters indicating where it is to be drawn and how big it is to be. Include a color as a parameter as well; this will make the function more flexible. Create additional helper functions as you see fit. Draw several shapes (at least ten) in an attractive pattern; do something unique and interesting (e.g., draw a landscape or an eye-catching repeating geometric design). Page 1 of 3 CSC142 4 Calculations 5 Code Implementation Create a class called GraphicsProject; use this single class to do all your work. You should have only one main function that controls both parts of the project. Follow the Course Style Guide. Drawing panel and graphics objects. Math methods like Math.round. Java Programming I 5.1 What You May Use Constants and variables; use the requested naming convention and declare them at the appropriate scope (i.e., use no global variables unless necessary, but global constants where they make sense). Definite loops (note that only one loop should be needed in Part 1). Use the DrawingPanel.java class provided. Put this in the same folder as your solution. Use procedural decomposition to break down the program into logical pieces. Part 1: create and use class-level constants for the drawing panel size and the line increment. Part 1: try various line increments until you find one that is visually pleasing and looks curved. Note that the vertical increment will always be double the horizontal increment. 5.2 What You May Not Use Selection control structures, unless you are doing something "above and beyond" the basic spec. That means no if statements, switch statements, or ternary operators. 6 Submitting Your Work Submit your .java file; there is no need to submit the DrawingPanel.java code. 7 Hints Look over the supplied sample code that uses the DrawingPanel. Having a link to the online Java API reference will come in handy now and in the future. Do not duplicate code if it is avoidable; this is a good rule now and always. Barry 8 Extra Credit: Gradients For Part 1, instead of the drawing shown there, produce the one shown at right. Lines within quadrants are each a slightly different color. In this example, lines start with green but move slowly toward blue. Your code must work with any two colors specified. Create Color constants START_COLOR and END_COLOR; make sure that any two colors you set work correctly. I will check your work by setting these to colors of my choosing. Page 2 of 3 CSC142 9 Grading Matrix Area Part 1 Drawing accuracy Coloring Looping Minimization of global variables General coding Part 2 Shape and color requirements Function usage Documentation and style Extra Credit Total Java Programming I Percent 15% 10% 20% 10% 10% 10% 15% 10% 3% 103% Page 3 of 3 Barry CSC142 Project 2: Draw Curves from Straight Lines 1 Objective In this program you will use existing objects. You will also learn about and use graphics coordinates. 2 Input The only input comes from an argument to main(), used for Part 1. Pass in a string representing the desired size of the drawing panel (e.g., 400) which will help test the flexibility of your code. When running main in BlueJ, provide the argument this way, when asked: {"400"} In code, convert the parameter to an integer this way: Integer.parseInt(args[0]); int dpSize = No terminal/console output should be shown; only the graphics should appear. 3 Output 3.1 Part 1 Generate this graphic output shown above right, on a DrawingPanel of the size specified in the argument to main. Java Programming I 3.2 Barry Alter the colors to suit your taste (but use at least two different colors of lines on a non-white background). Set the increment between lines to something pleasing to the eye; it does not need to exactly match the sample. Create an integer constant called LINE_INCREMENT for this purpose. I should be able to change that to a different number (evenly divisible or not) and see the expected output. For descriptions of the technique and samples of output, see these sites: site1, site2. Part 2 Create an additional drawing panel at least 600 x 600. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors. Lines don't count as shapes, here. And black doesn't count as one of the two colors; be a bit more creative and colorful, please. Each shape type should be drawn by its own function (that you write) with parameters indicating where it is to be drawn and how big it is to be. Include a color as a parameter as well; this will make the function more flexible. Create additional helper functions as you see fit. Draw several shapes (at least ten) in an attractive pattern; do something unique and interesting (e.g., draw a landscape or an eye-catching repeating geometric design). Page 1 of 3 CSC142 4 Calculations 5 Code Implementation Create a class called GraphicsProject; use this single class to do all your work. You should have only one main function that controls both parts of the project. Follow the Course Style Guide. Drawing panel and graphics objects. Math methods like Math.round. Java Programming I 5.1 What You May Use Constants and variables; use the requested naming convention and declare them at the appropriate scope (i.e., use no global variables unless necessary, but global constants where they make sense). Definite loops (note that only one loop should be needed in Part 1). Use the DrawingPanel.java class provided. Put this in the same folder as your solution. Use procedural decomposition to break down the program into logical pieces. Part 1: create and use class-level constants for the drawing panel size and the line increment. Part 1: try various line increments until you find one that is visually pleasing and looks curved. Note that the vertical increment will always be double the horizontal increment. 5.2 What You May Not Use Selection control structures, unless you are doing something "above and beyond" the basic spec. That means no if statements, switch statements, or ternary operators. 6 Submitting Your Work Submit your .java file; there is no need to submit the DrawingPanel.java code. 7 Hints Look over the supplied sample code that uses the DrawingPanel. Having a link to the online Java API reference will come in handy now and in the future. Do not duplicate code if it is avoidable; this is a good rule now and always. Barry 8 Extra Credit: Gradients For Part 1, instead of the drawing shown there, produce the one shown at right. Lines within quadrants are each a slightly different color. In this example, lines start with green but move slowly toward blue. Your code must work with any two colors specified. Create Color constants START_COLOR and END_COLOR; make sure that any two colors you set work correctly. I will check your work by setting these to colors of my choosing. Page 2 of 3 CSC142 9 Grading Matrix Area Part 1 Drawing accuracy Coloring Looping Minimization of global variables General coding Part 2 Shape and color requirements Function usage Documentation and style Extra Credit Total Java Programming I Percent 15% 10% 20% 10% 10% 10% 15% 10% 3% 103% Page 3 of 3 Barry
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Let r and s be solutions to the quadratic equation x 2 b x + c = 0. For n N, define d0 = 0 d1 = r s dn = b dn1 c dn2 (n 2) Prove that dn = r n s n for all n N. [4 marks] (b) Recall that a commutative...
-
why people who are sophisticated but face borrowing constraint would increase consumption when they receive transfer payment?
-
How does heat differ from internal energy, or are they two terms for the same thing?
-
Set up systems of equations and solve by any appropriate method. All numbers are accurate to at least two significant digits. A satellite is to be launched from a space shuttle. It is calculated that...
-
Refer to the information in Exercise 22-12. Assume that each of the companys divisions has a required rate of return of 7%. Compute residual income for each division. Data From Exercise 22-12 A food...
-
(EPS: Simple Capital Structure) On January 1, 2010, Chang Corp. had 480,000 shares of common stock outstanding. During 2010, it had the following transactions that affected the common stock account....
-
Even method: 1- Algorithm Compare between recursion and iteration 2- Memory representation (Ex: EVEV (0,10)) recursion iteration
-
tell which of the listed social media groups you are a member of? How do you use them(consume, share, produce, what do you do on them?)? Do you think that you use the sites safely? Do you think that...
-
Monkey Shines Ltd . , a Canadian public corporation, owns equipment for which the following year - end information is available: Carrying amount ( book value ) . . . . . . . . . . . . . . . . . . . ....
-
Assume the exchange rate is defined as f/$. What is the real exchange rate? If there is and appreciation of the $, what happens to the price of foreign goods measured in dollars and of US goods...
-
1.A family desires to have 300,000 available for a daughters college expenses in 20 years. If 8% can be earned on the invested capital, what is the starting amount today? a. $64,364 b. $100,916 c....
-
Let V = (v1,..., Vn) be a family of vectors in R Furthermore, (,) denotes that canonical dot product. Then the elements gij of the Gram's matrix G are by means Bij = (vi, vj) Are defined. The...
-
Please help figuring out this exercise getting market data for two bonds belonging to United Parcel Service and Fedex. Go to FINRA's website...
-
Explain and analyze the positive and negative features of the internet. Do you think that it has more plus points than the negative ones? Give logical arguments to support your answer.
-
Whats the difference between an ordinary annuity and an annuity due? What type of annuity is shown below? How would you change the time line to show the other type of annuity?
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
Mike sells his home to Jane on April 2, 2012. Jane pays the property taxes covering the full calendar year in October, which amount to $2,500. How much may Mike and Jane each deduct for property...
-
Dr. George E. Beeper is a single taxpayer. He lives at 45 Mountain View Dr., Apt. 321, Spokane, WA 99210. Dr. Beeper's Social Security number is 775-88-9531. Dr. Beeper works for the Pine Medical...
-
On January 2, 2018, The Register, a science and technology news site based in Britain, published an article revealing the existence of two major bugs leaving virtually all computers and smartphones...
-
In the 1970s, Special Electric Company brokered the sale of crocidolite asbestos, which is the most toxic form of asbestos, to Johns- Manville Corporation. Special Electric never held possession of...
-
Plaintiffs W. O. and J. C. Lucy had wanted to purchase Ferguson Farm from the Zehmers for at least eight years. One night, Lucy stopped by the establishment the Zehmers operated and said that he bet...
Study smarter with the SolutionInn App