write a computer program in java that draws a line and circle based on the screen pixels. As we learned, drawing these primitives can be achieved using different Algorithms. Initially, the program should ask the user to enter 1 to draw a line or 2 for the circle. (1) If the user entered 1, the program should prompt the user to enter the first two endpoints of the line (x1, y1) as well as the second endpoints (x2, y2). before drawing the line, the program should ask the user to choose the desired algorithm A: Bresenham's Algorithm or B: DDA Algorithm. Finally, the program should draw the line based on the pixels shown on the screen using the chosen Algorithm. (2) For the circle, the program should prompt the user to enter the radius of the circle, the coordinate of the circle center (h,k), as well as the first point on the circumference (if needed). Before drawing the circle, the program should ask the user to choose the desired Algorithm: A: Bresenham's Algorithm, B: Trigonometric method, and C: Mid-point circle Algorithm. Finally, the program should draw a circle using the given input as well as the chosen Algorithm. Note: please make sure that your program shows the undertaken steps of the selected algorithms while drawing a line or a circle.
write a computer
pixels. As we learned, drawing these primitives can be achieved using
different Algorithms. Initially, the program should ask the user to enter 1 to
draw a line or 2 for the circle.
(1) If the user entered 1, the program should prompt the user to enter the first
two endpoints of the line (x1, y1) as well as the second endpoints (x2, y2).
before drawing the line, the program should ask the user to choose the desired
program should draw the line based on the pixels shown on the screen using
the chosen Algorithm.
(2) For the circle, the program should prompt the user to enter the radius of
the circle, the coordinate of the circle center (h,k), as well as the first point on
the circumference (if needed). Before drawing the circle, the program should
ask the user to choose the desired Algorithm: A: Bresenham's Algorithm, B:
Trigonometric method, and C: Mid-point circle Algorithm. Finally, the
program should draw a circle using the given input as well as the chosen
Algorithm.
Note: please make sure that your program shows the undertaken steps of the
selected algorithms while drawing a line or a circle.
Trending now
This is a popular solution!
Step by step
Solved in 10 steps with 5 images