首页 > > 详细

辅导COMP4033编程设计、Java程序调试、program语言编程辅导辅导留学生 Statistics统计、回归、迭代|辅导Web开发

COMP4033 Assignment 1 - Basic Computer Graphics (5%)
Due: 11:59pm, 13 March 2021
Complete the following two exercises by writing a Java program for each:
1. Draw a set of concentric pairs of squares, each consisting of a square with horizontal and vertical edges
and one rotated through 45°. Except for the outermost square, the vertices of each square are the
midpoints of the edges of its immediately surrounding square, as Figure 1 shows. It is required that all
lines are exactly straight, and that vertices of smaller squares lie exactly on the edges of larger ones.
Figure 1. Concentric squares
2. Write a program that draws a pattern of hexagons, as shown in Figure 2. The vertices of a (regular)
hexagon lie on its so-called circumscribed circle. The user must be able to specify the radius of this circle
by clicking a point near the upper-left corner of the drawing rectangle. Then the distance between that
point and that corner is to be used as the radius of the circle just mentioned. There must be as many
hexagons of the specified size as possible and the margins on the left and the right must be equal. The
same applies to the upper and lower margins, as Figure 2 shows.
Note: you should try to minimize the number of lines that are drawn more than once. You can see the
repeated lines by using a different foreground color for each round of drawing, or better, by using the
XOR writing mode with the foreground color being black (if you know how to use XOR mode).
Figure 2. Hexagons
Put the 2 Java source programs in a ZIP file and name it as “Ass1_1234567890" (replace
1234567890 with your student ID number). Submit your ZIP file through iSpace before the due
time. Late submissions will NOT be accepted.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!