Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I will need you to write the code in java language. Write a program which displays straight lines inside a rectangle from one side to

I will need you to write the code in java language.
Write a program which displays straight lines inside a rectangle from one side to a perpendicular side. The lines must be drawn in such a way that both the starting points of the lines on one side and the ending points on the other side are equidistant along the sides. The size of the rectangle is 980 pixels width by 630 pixels height.
image text in transcribed
image text in transcribed
image text in transcribed
Graphics Lab Assignment Purpose: The purpose of this program is to demonstrate knowledge of loop control structures combined with Graphics methods. Write a program, which displays straight lines inside a rectangle from one side to a perpendicular side. The lines must be drawn in such a way that both the starting points of the lines on one side and the ending points on the other side are equidistant along the sides. The size of the rectangle is 980 pixels width by 630 pixels height. // GraphicsLab import java.awt. import java.applet": public class Graphicst.abst extends Applet public void paint(Graphics g) int width 980 int height = 630 int x1 - 10: int y1 - 640: int x2990 int y2 - 640; g.drawRect( 10.10,width height: // Draw bottom-right corner Mloop will run 51 times lix increment or decrement by some numbet 50 lly increment or decrement by some number 30 1/ Draw bottom-left corner loop will run 51 times 1/x increment or decrement by some number 50 ply increment or decrement by some number 50 # Draw top-right corner // Draw top-left corner 70 Point Version Specifics The 70-point lab assignment displays lines in bottom-right corner only. Do not be concerned with the appearance of the output. The curved line you see is an illusion. Everything is drawn with straight lines. Make no attempt to try and draw some type of arc. One challenge you need to handle is the fact that starting and end points need to be equidistant. The width and height of the rectangle are different. If you use the same distance on both sides then you will be finished on the shorter height before you have drawn all the lines on the longer width. The spaces between starting points on the width and ending points on the height are not the same 80 Point Version Specifics The 80-point lab assignment displays lines in the bottom-right comer and bottom-left corner. This is an example where you can benefit from a functional 70-point version. Block-copy the code segment that draws the bottom-right corner and then alter the values in such a way that the bottom-right corner is drawn. 90 Point Version Specifics The 90-point lab assignment displays lines in all four of the rectangle corners. Once again block copying can save time due to the similarity of the code. There is one warning about block copying It is a timesaving tool. but it is also an error duplicator. If the source code is not tested properly, you will be block-copying many errors. Another problem is that after block copying you fail to make the necessary changes. 100 Point Version Specifics The 100-point, extra-credit, version repeat the entire process by drawing a small copy of the previous 90-point version inside the blank space of the design. The drawing on the last page clarifies the requirement. Graphics Lab Assignment Purpose: The purpose of this program is to demonstrate knowledge of loop control structures combined with Graphics methods. Write a program, which displays straight lines inside a rectangle from one side to a perpendicular side. The lines must be drawn in such a way that both the starting points of the lines on one side and the ending points on the other side are equidistant along the sides. The size of the rectangle is 980 pixels width by 630 pixels height. // GraphicsLab import java.awt. import java.applet": public class Graphicst.abst extends Applet public void paint(Graphics g) int width 980 int height = 630 int x1 - 10: int y1 - 640: int x2990 int y2 - 640; g.drawRect( 10.10,width height: // Draw bottom-right corner Mloop will run 51 times lix increment or decrement by some numbet 50 lly increment or decrement by some number 30 1/ Draw bottom-left corner loop will run 51 times 1/x increment or decrement by some number 50 ply increment or decrement by some number 50 # Draw top-right corner // Draw top-left corner 70 Point Version Specifics The 70-point lab assignment displays lines in bottom-right corner only. Do not be concerned with the appearance of the output. The curved line you see is an illusion. Everything is drawn with straight lines. Make no attempt to try and draw some type of arc. One challenge you need to handle is the fact that starting and end points need to be equidistant. The width and height of the rectangle are different. If you use the same distance on both sides then you will be finished on the shorter height before you have drawn all the lines on the longer width. The spaces between starting points on the width and ending points on the height are not the same 80 Point Version Specifics The 80-point lab assignment displays lines in the bottom-right comer and bottom-left corner. This is an example where you can benefit from a functional 70-point version. Block-copy the code segment that draws the bottom-right corner and then alter the values in such a way that the bottom-right corner is drawn. 90 Point Version Specifics The 90-point lab assignment displays lines in all four of the rectangle corners. Once again block copying can save time due to the similarity of the code. There is one warning about block copying It is a timesaving tool. but it is also an error duplicator. If the source code is not tested properly, you will be block-copying many errors. Another problem is that after block copying you fail to make the necessary changes. 100 Point Version Specifics The 100-point, extra-credit, version repeat the entire process by drawing a small copy of the previous 90-point version inside the blank space of the design. The drawing on the last page clarifies the requirement

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

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

List the goals of a persuasive message.

Answered: 1 week ago