For Loop, Objects, DrawString, Fonts & Radio buttons (100 points)
Write an applet called Project39.java which will allow the user to
enter a minimum and maximum integer. Write an object called AddInts.java
which Project39.java will call. AddInts.java must calculate the
sum from the minimum to the maximum. The sum must be returned to
Project39.java as an integer. Have Project39.java ouput
each term from the minimum to the maximum using the drawString
method. Project39.java Must also output the sum of these integers
calculated by AddInts.java. Do not output more than 5 terms per line,
and make sure the last term is not succeeded by a plus sign.
If the minimum integer entered is larger than the maximum, then make sure you
output an message indicating the error. For example,
If the minimum is 7 and the maximum is 22 then output :
7 + 8 + 9 + 10 + 11 +
12+ 13 + 14 + 15 + 16 +
17 + 18 + 19 + 20 + 21 +
22 = 232
Before the maximum and minimum integers are entered, supply a menu of radio
buttons to the
user to decide upon the name and style of the font in which the output will
be displayed. The menu should be as follow :
If the minimum is 22 and the maximum is 7 then output :
The minimum should be
smaller than the
maximum. RELOAD the page
and please try again.
Select you output font.
- Document your applet. Include your Name, Date, Project#, and a
description of the project.
- Test your results with a calculator. Try all possibilities.
- Input the data with the TextField class
- Output the sum with the drawString method.
- Use size 15 to output the terms and the sum.
- The HTML file which displays your applet must have width=225 and height=500.
Sample Output for project 39