Question: it is required to develop class called star in java to draw a regular star with number of equal spikes in the center of frame
it is required to develop class called star in java to draw a regular star with number of equal spikes in the center of frame of size 400x350
[a] the class will have as instant variable spikes for the number of spikes of the star, write method init to get the number of spikes from the param of html file and assign it in instance variable spikes to be used by paint method to draw the star . the value of spikes should be between 5 and 10. if it is not in the range, then use 5 as the default value and output suitable message.
[b] write the paint method to draw the star having spikes as the number of spikes. the star is to be filled with red color (use sin and cos method of Class math) and for loop to calculate the coordinate points of the star . if the window is resized the geometric shape should adjust accordingly.
[c] Write html file for applet . This file contains title as red Star, param name = spikes with value = 5.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
