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

For this assignment, you will create a new Netbeans project using the following

ID: 3819904 • Letter: F

Question

For this assignment, you will create a new Netbeans project using the following format LastNameFirstName-Homework6 and follow all instructions as given for each part of the assignment. Turn-in Instructions: Once finished, zip your project directory (which should result in a zip file named LastNameFirstName-Homework6.zip) and turn in via blackboard by the due date. No late homeworks will be accepted since the solution will appear on the deadline! Class Grading Simulation: we will be simulating test scores and homework scores for students, curving the individual test scores, determining if we need to offer extra credit, and reporting final averages for all students. We will be simulating students by using three arrays for 100 students. The first array holds their name (1 per student) The second array will hold their homework scores (6 per student) The third array will hold their exam scores (3 per student) Initialize the Arrays using the following instructions: The name array should be initialized using random first names and random last names in the format LastName, FirstName (like we did in class) The homework score array should be initialized using random integers between 60 and 100 for each student The test score array should be initialized using random numbers between 60 and 100 For each exam, determine if there needs to be a curve and do something about it if necessary. A curve is necessary if the average of the scores for that exam is below 75. If a curve is necessary, add the curve to the test scores and report the curve (if no curve, necessary report that as well) Determine if there needs to be homework extra-credit offered. Extra credit is necessary if and only if the average of all non-zero homeworks for all students is less than 75 If extra-credit is necessary, determine how much (75-average)*2 and offer it. You should assume that only some people will do it, so add to everyone's last homework a random amount of extra credit between 0 and (75-average)*2. If extra-credit was necessary, report how much was offered, otherwise report none was necessary. Report the results of the simulated class! Calculate the final grade for each student using the grading of this class (15% for exam1, 25% for exam2, 30% for exam3) and 30% for the homework average Report the final score for each student on its own line similar to: LastName, FirstName: SCORE Print a blank line and then report the frequency (percentage using %) of each final grade in the class. Name your file: ClassSimulation.java

Explanation / Answer

import java.util.HashMap;
import java.util.Random;
import java.util.UUID;

public class ClassSimulation {

   public static void main(String args[]){
   //declaring array
   String firstName[]=new String[2];
   String lastName[]=new String[2];
   int homeworkScore[][] =new int[2][6];
   int examScore[][]=new int[2][3];
   int avgExam[]=new int[2];
   int avgHomework[]=new int[2];
   int extraCredit[]=new int[2];
   int finalGrade[]=new int[2];
  
   for(int i=0;i<2;i++){
      
       //initializing array for name
       firstName[i]=UUID.randomUUID().toString();
       lastName[i]=UUID.randomUUID().toString();
       Random r = new Random();
      
       //initialize array for homework score
      
       int Low = 60;
       int High = 100;
       int res1 = r.nextInt(High-Low) + Low;
       int res2 = r.nextInt(High-Low) + Low;
       int res3 = r.nextInt(High-Low) + Low;
       int res4 = r.nextInt(High-Low) + Low;
       int res5 = r.nextInt(High-Low) + Low;
       int res6 = r.nextInt(High-Low) + Low;
       homeworkScore[i][0]=res1;
       homeworkScore[i][1]=res2;
       homeworkScore[i][2]=res3;
       homeworkScore[i][3]=res4;
       homeworkScore[i][4]=res5;
       homeworkScore[i][5]=res6;
      
       //initialize array for exam score
       int r1 = r.nextInt(High-Low) + Low;
       int r2 = r.nextInt(High-Low) + Low;
       int r3 = r.nextInt(High-Low) + Low;
       examScore[i][0]=r1;
       examScore[i][1]=r2;
       examScore[i][2]=r3;
   }
  
   //Curve for below 75 in exams
   for(int i=0;i<2;i++){
       avgExam[i]=(examScore[i][0]+examScore[i][1]+examScore[i][2])/3;
       if(avgExam[i]<75){
           System.out.println("Curve is necessary");
       }else{
           System.out.println(" No Curve is necessary");
       }
   }
  
   //extra credit for below 75
   for(int i=0;i<2;i++){
       for(int j=0;j<6;j++){
           if(homeworkScore[i][j]>0){
               avgHomework[i]=homeworkScore[i][j];
           }
       }
      
   }
  
   for(int i=0;i<2;i++){
       if(avgHomework[i]<75){
           //extra credit is necessary then add random number to last homework
           Random r=new Random();
           int low=0;
           int high=(75-avgHomework[i])*2;
           extraCredit[i] = r.nextInt(high-low) + low;
           System.out.println("Extra Credit is Added to Student id = "+i+" ="+extraCredit[i]);
           homeworkScore[i][5]=homeworkScore[i][5]+extraCredit[i];
       }
   }
  
   //Print Score and Grade
   System.out.println("LastName FirstName :Score");
   for(int i=0;i<2;i++){
       finalGrade[i]=((examScore[i][0]*15)/100)+((examScore[i][1]*25)/100)+
               ((examScore[i][2]*30)/100)+((avgHomework[i]*30)/100);
       System.out.println(lastName[i]+" "+firstName[i]+" "+finalGrade[i]);
   }
  
   System.out.println("-----------------------");
  
   HashMap<Integer,Integer> frequency=new HashMap<Integer,Integer>();
for (int i : finalGrade){
if (frequency.containsKey(i)){
   frequency.put(i, frequency.get(i)+1);
} else {
   frequency.put(i, 1);
}
}
for (int key:frequency.keySet()){
System.out.println(key+" final grade "+frequency.get(key));
}

   }
}

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