Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program (Note the extra credit below if done in a user-defined class) to

ID: 3647428 • Letter: W

Question

Write a program (Note the extra credit below if done in a user-defined class) to enter student names and grades ( I recommend using only 4 students) that will also print out the total number of passing students and the total number of failing students. The name and the grade should be stored in two parallel ** arrays; one array of String and one array of integers. The names and grades must be entered by the user by means of JOptionPane InputDialog() commands. Create a method to perform the graphical printing and pass the arrays to it as well as the two counters. That method will have a loop to go through the array so that all students and the individual grades are shown as well as a total of how many students passed and how many students failed ALL IN ONE window. Input statements and the if statement to determine whether or not a grade is passing or failing can be in the main method. A passing grade is 60 or higher. If the grade is passing, add one to the passing counter. If the grade is failing, add one to the failing counter.

All input, processing and the call to output method should be in a loop which is controlled by a loop - a for loop structure so that the number of students entered does not go beyond the size of the array. (In real life, a variable size array would be used to allow for the varying number of students in a class. OR You may, if you wish, ask the user at the outset, how many students will be entered and use that value to give a size to the array)

Explanation / Answer

import javax.swing.JOptionPane; //import class JOptionPane public class Addition { public static void main ( String args[] ) { String[] name= new String[4]; String[] grade=new String[4]; int i; int num; int pass=0; int fail=0; for(i=0;i60||num==60) pass++; else fail++; } String newline = System.getProperty("line.separator"); StringBuilder sb = new StringBuilder("NAME"); sb.append(" "); sb.append("Grade");sb.append(newline); for(i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote