advertisement

Java Assignment #3 Homework: Due Sep 21, 2007 3.1 #1, 2, 3, 4 3.2 #1 – 6, 8 – 19, 21, 23 – 27 3.4 #1, 2 3.5 #1 – 3 3.6 #1 Programs: Due Sep 28, 2007 1. Your program will input two integers a, and b; two doubles x, and y; and two char ch1, and ch2. Output each of the following calculations: (Example: if you were outputting the answer to a., and you had a = 5 and b = 7 the output should look like: 5 / 7 = 0). If the computer does not allow you to perform a certain calculation, state the reason why as the output. For example, if a % x is not allowed output a % x is not allowed because of __________. a. a / b b. b / a c. a % b d. b % a e. a / x f. x / a g. x % a h. a % x i. cast x to an int j. cast a*b to a double k. cast a*b to a char l. ch1 + ch2 m. ch1 / ch2 n. ch1 + a o. cast ch1 + a to a char. 2. Write a program that computes the area of a triangle. You input the length of one side called the base, the length of a second side called a, and the included angle (in degrees). The program computes the area of the triangle. Degree Radian a. Your program will need to change the angle to radians 180 b. You will need to calculate the height: h a sin( ) 1 c. Compute the area of the triangle: A * base * height 2 d. Output the results. 3. Create an applet that draws a funny face. It should have eyes, eye brows, nose, mouth, ears, a few freckles, and some hair.