Question
the code below is for exercise02. the question based exercise02. package exercise02; import javafx.geometry.Point2D; import javafx.scene.shape.Polygon; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; /************************************************************************ * Lab 04 Exercise
the code below is for exercise02. the question based exercise02.
package exercise02;
import javafx.geometry.Point2D; import javafx.scene.shape.Polygon; import javafx.scene.layout.Pane; import javafx.scene.paint.Color;
/************************************************************************ *
Lab 04 Exercise 02 * This is a pane for displaying different levels of a Sierpinski * Triangle constructed with line segments. ************************************************************************/ public class LinedSierpinski extends Pane{
/******************************************************** * data field: keeps the value of the current level * of the Sierpinski Triangle. * *****************************************************/ private int level; /********************************************************** * constructor that generates and initializes the * attributes of the Sierpinski Triangle. * ********************************************************/ public LinedSierpinski() { level = 1; } /********************************************************** * validates the level of the Sierpinski Triangle and * returns a valid level. * ********************************************************/ public int checkLevel(int level) { if (level Exercise 02 Questions inspect and run the code in package exercise02 and answer the following questions. Questions How do you obtain the midpoint between two points? State the mathematic formula. y/ What is the end case for the drawFigure method? How many times is the drawFigure method invoked for a Sierpinski triangle of order 4, and 7? What does the checklevel method do? Does this method handle any preconditions? If so, what are they? Explain in at least 3 sentences. (PRINT) Describe the behavior of the getLevel method and setLevel method i.e. what operations do they do? Explain in at least 3 sentences. (PRINT) Exercise 02 Questions inspect and run the code in package exercise02 and answer the following questions. Questions How do you obtain the midpoint between two points? State the mathematic formula. y/ What is the end case for the drawFigure method? How many times is the drawFigure method invoked for a Sierpinski triangle of order 4, and 7? What does the checklevel method do? Does this method handle any preconditions? If so, what are they? Explain in at least 3 sentences. (PRINT) Describe the behavior of the getLevel method and setLevel method i.e. what operations do they do? Explain in at least 3 sentences. (PRINT)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started