Test your program on different degrees; if your program is working correctly, the result should be 1 each time (pythagorean trigonometric identity). Refer to the Java API for the Math class, i.e. Math methods sin, cos, pow, toRadians, round. If there is a logical error (i.e. the result is not correct), use the debugger to step through your program; it will be easier if you decompose the problem into subproblems rather than computing the entire formula in one statement.
Modify your solution to exercise 18 part a, so that there are 2 classes: 1) PrimitiveFiguresLibrary.java, a class with methods that draw primitive shapes such as a cone and a box, and 2) a class named House, whose main method draws two houses, by calling twice a method drawHouse (defined in the same class), which calls methods drawCone() and drawBox() of PrimtiveFiguresLibrary.
Working with an object of our own blueprint class (Circle, in this example). Read and understand a solution to quiz problem 6 (CircleStats.java). Redo this program in an object-based way, i.e. using a blueprint or data class (Circle.java) to create a Circle object, and invoke methods on this object to compute the area and circumference. You may solve this by modifying driver class CircleStats1.java and blueprint class Circle.java, by inserting code in the lines indicated by asterisks.
Point p1 = new Point (0, 0); Point p2 = new Point (4, 3); Point p3 = new Point (3, 4); Point p4 = new Point (0, 0);), then computes and prints the distance between the first 2 points and the distance between the last 2 points (by calling a method calcDistance as follows:
distance1 = p1.calcDistance (p2); distance2 = p3.calcDistance (p4);where p1, p2, p3 and p4 are Point objects, and calcDistance is a method to be defined in the Point class).
public String getName()
public double getAge()
public void setName(String)
public void setAge(double)
In the main method of driver class Tournament:
Fill in the missing code, where you see ... |
// Set up games 1 and 2. Game game1 = new Game ("Astros", "Red Sox"); Game game2 = new Game ("Brewers", "Dodgers"); // Determine the winner of game1. String winner = game1.computeWinner(); // Determine the winner of game2. ... // Set up the championship game (winner of game1 vs. winner of game2). ... // Determine the winner of the championship game. ... // Print the winners of each game. ... |
average | letter grade |
[90,100] | A |
[80,90) | B |
[70,80) | C |
[60,70) | D |
[0,60) | F |
row | star |
1 | 1 |
2 | 1 |
2 | 2 |
3 | 1 |
3 | 2 |
3 | 3 |
... | ... |