| 1. |
Create a program that asks the user to enter
values for A, B, C, and D and calculates and prints the value of
 |
| 2. |
Create a program that asks for a number, then
a second number, and displays a message to give the correct answer. If the
answer given display an appropriate message. If it is incorrect display an
encouraging message.
Type in a number: 5
Type in another : 7
Add 5 and 7: 13
Sorry, the correct answer is 12! |
| 3. |
Write a program to calculate the roots of the quadratic equation: ax2
+ bx + c = 0. Use the following formula: 
Be sure to watch for the possibility that .
Hint: Look in the Math class on the Java web site
for how to do square roots. |
| 4. |
Write a program that will calculate the Celsius temperature if given a
Fahrenheit temperature. The formula is

|
| 5. |
Write a program that will calculate the
Fahrenheit temperature when given a Celsius temperature. |
| 6. |
The square of a number can be found by adding
successive odd integers. For example, to find 42, add the first
four odd integers:
42 = 1 + 3 + 5 + 7 = 16
To find 62 , add the first six odd integers:
62 = 1 + 3 + 5 + 7 + 9 + 11 = 36
Create a program that asks for a number and then uses a for lop to
calculate its square using this method. |
| 7. |
Input a list of numbers (each will be under
100) and have the computer keep track of the largest value. Use 999 to
indicate the end of the list. Print the largest number. |
| 8. |
List all the values of the equation below
for
values of x: -10, -8,...,8, 10

|
| 9. |
Any integer less than 256 can be converted to binary by following this
series of steps:
- set a divisor variable equal to 128;
- divide the number by the divisor;
- print the integer quotient;
- reduce the original number by the value of the quotient multiplied by the divisor;
- divide the divisor by 2
- repeat steps (b) through (e) until the divisor is 1.
Write a program to ask for a number and convert it to binary. The following is a sample
calculation using the number 195 to find its binary equivalent 11000011.
Number |
Divisor |
Integer Quotient |
Reduce the original number |
| 195 |
|
128 |
|
1 |
|
195 - 128* 1 = 67 |
| 67 |
|
64 |
|
1 |
|
67 - 64* 1 = 3 |
| 3 |
|
32 |
|
0 |
|
3 - 32 * 0 = 3 |
| 3 |
|
16 |
|
0 |
|
3 - 16 * 0 = 3 |
| 3 |
|
8 |
|
0 |
|
3 - 8 * 0 = 3 |
| 3 |
|
4 |
|
0 |
|
3 - 4 * 0 = 3 |
| 3 |
|
2 |
|
1 |
|
3 - 2 * 1 = 1 |
| 1 |
|
1 |
|
1 |
|
1 - 1 * 1 = 0 |
You can print your answer out on the form:
1
1
0
0
0
0
1
1 |
or you can try to print it this way: 11000011
|
|
| 10. |
You find that you have a rich relative that has been depositing $1000 into a bank
account every year since you were born. The bank account earns 8% interest every year. How
old will you be when there is one million dollars in the account? |
| 11. |
Make a program where the user enters any two numbers.
The numbers will be displayed in sorted order (smallest to largest.)
For example if the numbers were entered in this order: 4 1
they would be displayed as: 1
4 |
| 12. |
Make a program where the user enters three numbers.
The numbers will be displayed in sorted order (smallest to largest.)
For example if the numbers were entered in this order: 4 1 7,
they would be displayed as: 1
4 7 |