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

I have created 3 classes separately.....student class, GrahicUsInterface class &

ID: 3660141 • Letter: I

Question

I have created 3 classes separately.....student class, GrahicUsInterface class & studentGrade class. Data are created as a file in the project folder. But I dont know how to do input processing & display bar graphs on clicking buttons.... I need help on Input processing from data file to studentGrade class & add action events to each buttons to display bar graphs. Student class..... public class Student { private String ID; private String name; private int[]homeworks; private int[]quizzes; private int midTerm; private int finalProject; private int index; //constructor public Student(String Id,String name1) { ID= Id; name = name1; homeworks = new int[6]; quizzes= new int[2]; } public String getID() { return ID; } public void setID(String Id) { ID = Id; } public String getName() { return name; } public void setName(String name1) { name = name1; } public void setHomeworkGrade(int index1,int homeworkGrade) { homeworks[index1] = homeworkGrade; } public void setQuizGrade( int index1,int QuizGrade) { quizzes[index1] = QuizGrade; } public int getMidterm(){ return midTerm; } public void setMidTerm(int MidTerm1){ midTerm=MidTerm1; } public int getFinalProject(){ return finalProject; } public void setFinalProject(int FinalProject1) { finalProject=FinalProject1; } public double getHomeworkAverage() { int total = 0; for (int i = 0; i < homeworks.length; i++) { total += homeworks[i]; } double HomeworkAverage = total / homeworks.length; return HomeworkAverage; } public double getQuizAverage(){ int total = 0; for (int i = 0; i < quizzes.length; i++) { total += quizzes[i]; } double QuizAverage = total / quizzes.length; return QuizAverage; } public double getCourseScore(){ double CourseScore=(getQuizAverage()*( 0.1)+.3*(getHomeworkAverage() + getMidterm() +getFinalProject())); return CourseScore; } public String getCourseGrade(){ int i=(int)(getCourseScore()/5);String Grade; switch(i) { case 20: Grade="A"; break; case 19: Grade="A"; break; case 18: Grade="A-"; break; case 17: Grade="B+"; break; case 16: Grade="B"; break; case 15: Grade="B-"; break; default: Grade="C"; break; } return Grade; } public String toString() { return String.format("The %s %s %d %d %.2f %.2f %.2f %s",ID,name, midTerm,finalProject,getHomeworkAverage(),getQuizAverage(), getCourseScore(), getCourseGrade() ); } } GRAPHIC CLASS.......... public class GraphicUserInterface extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private JButton b1,b2,b3,b4,b5,b6; private static ArrayList studentList; public GraphicUserInterface(ArrayList studentList) { super("Title"); GraphicUserInterface.studentList = studentList; JPanel panel = new JPanel(); getContentPane().add(panel); panel.setLayout(null); b1 = new JButton("Quiz"); b1.setBounds(30, 30, 80, 30);// Create a button b1.setBackground(Color.orange); b1.addActionListener( this ); // Register the event handler b1.setToolTipText("Displays statistics on Quizzes");//tool tip component panel.add(b1); // Add the button to the Application b2 = new JButton("Homeworks"); b2.setBounds(120, 30, 130, 30);// Create a button b2.setBackground(Color.blue); b2.addActionListener( this ); // Register the event handler b2.setToolTipText("Displays statistics on Homeworks"); panel.add(b2); // Add the button to the Application b3 = new JButton("MidTerm"); b3.setBounds(260, 30, 140, 30);// Create a button b3.setBackground(Color.red); b3.addActionListener( this ); // Register the event handler b3.setToolTipText("Displays statistics on MidTerm"); panel.add(b3); // Add the button to the Application b4 = new JButton("FinalProject"); b4.setBounds(410, 30, 140, 30);// Create a button b4.setBackground(Color.orange); b4.addActionListener( this ); // Register the event handler b4.setToolTipText("Displays statistics on FinalProject"); panel.add(b4); // Add the button to the Application b5 = new JButton("CourseScore"); b5.setBounds(560, 30, 140, 30);// Create a button b5.setBackground(Color.blue); b5.addActionListener( this ); // Register the event handler b5.setToolTipText("Displays Statistics on CourseScore"); panel.add(b5); // Add the button to the Application b6 = new JButton("CourseGrade"); b6.setBounds(710, 30, 140, 30);// Create a button b6.setBackground(Color.red); b6.addActionListener( this ); // Register the event handler b6.setToolTipText("Displays statistics on CourseGrade"); panel.add(b6); // Add the button to the Application } public void paint ( Graphics g ) { super.paint(g); setTitle("Statistics of the Performance of all the Students"); setLocationRelativeTo(null); setFont(new Font("Arial", Font.BOLD, 32)); g.drawString(" Statistics of the Students", 200, 150); } public void actionPerformed( ActionEvent e ) { if (e.getSource() == b1) { } else if (e.getSource()==b2) { } else if (e.getSource()==b3) { } else if (e.getSource()==b4) { } else if (e.getSource()==b5) { } else if (e.getSource()==b6) { } repaint(); } }

Explanation / Answer

let me provide you with a tip that will be very helpful Try using Visual studio Windows based development program what you are describing above, you need to just draw that out there and in the background , the code will be written by the software.Just place your existing code in it and VOLA!!

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