subject

Write 2 programs and submit on Autolab.

We provide this ZIP FILE containing PolygonTransform. java, and Sierpinski. java. For each problem update and submit the corresponding file.

Observe the following rules:

DO NOT use System. exit().
DO NOT add the project or package statements.
DO NOT change the class name.
DO NOT change the headers of ANY of the given methods.
DO NOT add any new class fields.
ONLY display the result as specified by the example for each problem.
DO NOT print other messages, follow the examples for each problem.
USE StdIn, StdOut, and StdDraw libraries.
Polygon transform (25 points). Write a library of static methods that performs various geometric transforms on polygons. Mathematically, a polygon is defined by its sequence of vertices (x0, y 0), (x 1, y 1), (x 2, y 2), …. In Java, we will represent a polygon by storing the x– and y-coordinates of the vertices in two parallel arrays x[] and y[].Three useful geometric transforms are scale, translate and rotate.

Scale the coordinates of each vertex (x i, y i) by a factor α.
x‘i = α xi
y‘i = α yi
Translate each vertex (x i, y i) by a given offset (dx, dy).
x‘i = xi + dx
y‘i = yi + dy
Rotate each vertex (x i, y i) by θ degrees counterclockwise, around the origin.
x‘i = xi cos θ – yi sin θ
y‘i = yi cos θ + xi sin θ
Write a two-dimensional transformation library by implementing the following API:public class PolygonTransform {

// Returns a new array object that is an exact copy of the given array.
// The given array is not mutated.
public static double[] copy(double[] array)

// Scales the polygon by the factor alpha.
public static void scale(double[] x, double[] y, double alpha)

// Translates the polygon by (dx, dy).
public static void translate(double[] x, double[] y, double dx, double dy)

// Rotates the polygon theta degrees counterclockwise, about the origin.
public static void rotate(double[] x, double[] y, double theta)

// Tests each of the API methods by directly calling them.
public static void main(String[] args) `

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:10
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Select all that apply. which of the following are proofreading options included in microsoft word? spell check find replace grammar check formatting check
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
You know the right answer?
Write 2 programs and submit on Autolab.

We provide this ZIP FILE containing PolygonTrans...
Questions
question
Mathematics, 08.09.2020 14:01
question
English, 08.09.2020 14:01
Questions on the website: 13722361