Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package percentpasssing;
- import javax.swing.JOptionPane;
- public class PercentPasssing {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int a, percentRound, loop = 0;
- double score, loopCount, percent, pass = 0;
- String num1 = JOptionPane.showInputDialog("How many scores?");
- a = Integer.parseInt(num1);
- loopCount = (double) a;
- do {
- loop += 1;
- String num2 = JOptionPane.showInputDialog("Input score " + loop);
- score = Integer.parseInt(num2);
- if (score > 70) {
- pass += 1;
- }
- percent = pass / loopCount * 100;
- } while (loop < loopCount);
- percentRound = (int) percent;
- System.out.print(percentRound + "% of scores passed. \n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement