deaishaajennings123
12.03.2020 •
Chemistry
The potential energy of molecules decrease as they get closer to one another. Energy is given off when the attraction between two molecules is broken. Intermolecular forces are generally stronger than bonding forces. Increasing the pressure on a solid usually causes it to become a liquid. None of the above are true.
Solved
Show answers
More tips
Answers on questions: Chemistry
- C Chemistry Answer fast ! in a solution of salt and water, the concentration of salt molecules is greater outside a cell than inside. based on this information will the water molecules and the...
- C Chemistry Help I going to fell I have to 11:59 help please It’s amplify Science These two arguments both answer the question Why did Patient 23 feel sick during week 3? Which of these arguments...
- C Chemistry Calculate the formula mass for HFO2...
- C Chemistry A heated fruit pie often seems to have feeling that it’s warmer than the crust why is this?...
- C Chemistry PLS HELP Which type of force is a contact force? A. Electromagnetic force B. Friction C. Strong nuclear force D. Gravity SUBMT...
- C Chemistry How does the atomic structure affect the behavior and properties of an atom? what are the roles of protons and electrons? what are noble gases and why are they the most stable elements?...
- C Chemistry which two forces act on igneous rock to change it into metamorphic rock? a) erosion and pressure b) heat and volcanism c) heat and pressure d) sediment and erosion...
- C Chemistry Container A holds 782 mL of ideal gas at 2.70 atm . Container B holds 179 mL of ideal gas at 4.50 atm . If the gases are allowed to mix together, what is the partial pressure of...
- C Chemistry When the following equation is balanced with lowest whole-number coefficients, what is the coefficient for NO(g)? ___NH3(g) + ___O2(g) → ___NO(g) + ___H2O(g)...
- H Health In an experiment, the effect of a chemical on neuromuscular synapses led to the cessation of transmission of excitation from a nerve to a skeletal muscle.The introduction of acetylcholine...
Ответ:
/ Sierpinski.java
public class Sierpinski {
// method to find the height of an equilateral triangle with side length =
// length
public static double height(double length) {
// formula= length*sqrt(3)/2
double h = (length * Math.sqrt(3)) / 2.0;
return h;
}
// method to draw a filled triangle (pointed downwards) with bottom vertex
// x,y
public static void filledTriangle(double x, double y, double length) {
// finding height
double h = height(length);
// filling triangle as a polygon
// passing x, x-length/2, x+length/2 as x coordinates
// and y, y+h, y+h as y coordinates
StdDraw.filledPolygon(new double[] { x, x - (length / 2.0),
x + (length / 2.0) }, new double[] { y, y + h, y + h });
}
// method to draw an n level sierpinski triangle
public static void sierpinski(int n, double x, double y, double length) {
// checking if n is above 0 (base condition)
if (n > 0) {
// drawing a filled triangle with x, y as bottom coordinate, length
// as side length
filledTriangle(x, y, length);
// drawing the triangle(s) on the top
sierpinski(n - 1, x, y + height(length), length / 2);
// drawing the triangle(s) on the left side
sierpinski(n - 1, x - (length / 2.0), y, length / 2);
// drawing the triangle(s) on the right side
sierpinski(n - 1, x + (length / 2.0), y, length / 2);
}
}
public static void main(String[] args) {
// parsing first command line argument as integer, if you dont provide
// the value while running the program, this program will cause
// exception.
int n = Integer.parseInt(args[0]);
// length of the outline triangle
double length = 1;
// finding height
double h = height(length);
// drawing a triangle (pointed upwards) to represent the outline.
StdDraw.polygon(new double[] { 0, length / 2, length }, new double[] {
0, h, 0 });
// drawing n level sierpinski triangle(s) with length / 2, 0 as x,y
// coordinates and length / 2 as initial side length
sierpinski(n, length / 2, 0, length / 2);
}
}