Results 1 to 2 of 2
Thread: Convert to Applet
- 11-12-2008, 07:01 AM #1
Member
- Join Date
- Oct 2008
- Posts
- 30
- Rep Power
- 0
Convert to Applet
How would I convert my program into a working applet? I just cant figure it out?
It takes 10 grades input by a user then finds the average, number above average, and the number below average.
Java Code:package AverageTestScore; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class AverageTestScore extends Applet { static BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in)); static InputStreamReader converter = new InputStreamReader (System.in); public static void main(String[] args) throws Throwable, IOException{ double[ ] grade = new double[10]; // assume no more than 70 grades int gradeCount = 0; double sum = 0; page.drawstring("Enter Grade: "); double value = Double.parseDouble(stdin.readLine()); while(gradeCount < 10 && (value >= 0 && value <= 100)){ grade[gradeCount] = value; sum += grade[gradeCount]; gradeCount++; System.out.print("Enter the next grade (Negative to skip to averages): "); value = Double.parseDouble(stdin.readLine()); } if(gradeCount == 0) System.out.println("No valid grades were entered"); else{ double average = sum / gradeCount; int count = 0; for(int k = 0; k < gradeCount; k++) if(grade[k] > average) count++; System.out.println("The average is: " + average); System.out.println("The number of grades above average is: " + count); System.out.println("The number of grades below the average is: " + (9-count)); } } }
- 11-12-2008, 01:15 PM #2
Member
- Join Date
- Nov 2008
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
convert XML using XSL
By rajjan4u in forum XMLReplies: 3Last Post: 11-20-2009, 04:37 PM -
Convert .java to .exe
By susan in forum New To JavaReplies: 6Last Post: 02-11-2009, 06:47 AM -
Convert the application from 9i to 10g
By rahul999 in forum JDBCReplies: 5Last Post: 09-03-2008, 03:55 PM -
Convert a program to Applet
By carl in forum Java AppletsReplies: 2Last Post: 08-09-2007, 09:33 PM -
Applet, To center text and To open I engage in a dialog in an Applet
By Marcus in forum Java AppletsReplies: 4Last Post: 06-08-2007, 06:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks