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

I already got answers to this question. The problem is that none of the answers

ID: 668882 • Letter: I

Question

I already got answers to this question. The problem is that none of the answers can be put into the program we are using in the class, which is Jeliot. So not only do I need the question answered, but it needs to be able to work in Jeliot, the program we are using, not just a write up. So when you write up the program, make sure it can be executed in Jeliot.

Create a program in Java that does the following:

1) Creates an array "student_gpa" of size 10 and contains the current GPA of 10 students (assume the GPA is in the range 0-4).

2) Computes the percentage of students that get scholarship because their GPA is at least 3.5

3) Computes the average GPA of all students.

4) Computes the average GPA of the students with scholarship.

5) Computes the average GPA of the students without scholarship.

REQUIREMENTS:

a) You must include a "for" loop in answering the parts 2,3,4,5

b) You must not create any additional array besides "student_gpa". You may create individual variables to store the answers of questions 2,3,4,5.

Explanation / Answer

=====================================================

Output

=====================================================

Enter student GPA scores:
3
4
3.5
2
1
2.5
1.5
4
3
3.5
The percentage of students that get scholarship: 40.0
The average GPA of all students: 2.8
The average GPA of the students with scholarship: 1.5
The average GPA of the students without scholarship: 1.3

=====================================================

Program name StudentGPA.java

=====================================================

import java.util.Scanner;


public class StudentGPA {

   public static void main(String[] args) {

       double studentsGPA[] = new double[10];
       int totalEligibleCount=0;

       double scholarshipPercentage;
      
       double totalGPA=0.0;
       double averageGPAPercentage;

       double totalScholarshipGPA=0.0;
       double averageScholarshipGPAPercentage;

       double totalNonScholarshipGPA=0.0;
       double averageNonScholarshipGPAPercentage;

      
       Scanner sc = new Scanner(System.in);
       System.out.println("Enter student GPA scores: ");
       for(int i=0;i<studentsGPA.length;i++) {
           studentsGPA[i] = sc.nextDouble();
       }
      
       //Compute scholarship eligible count
       for(int i=0;i<studentsGPA.length;i++) {

           if(studentsGPA[i]>=3.5) {
               totalEligibleCount++;  
           }
       }
      

       scholarshipPercentage = ((double)totalEligibleCount/studentsGPA.length)*100;
       System.out.println("The percentage of students that get scholarship: "+scholarshipPercentage);
      
       //Compute average GPA of all students
       for(int i=0;i<studentsGPA.length;i++) {

           totalGPA = totalGPA + studentsGPA[i];
       }
  
       averageGPAPercentage = totalGPA/studentsGPA.length;
       System.out.println("The average GPA of all students: "+averageGPAPercentage);

       //Compute average GPA of scholarship students
       for(int i=0;i<studentsGPA.length;i++) {
           if(studentsGPA[i]>=3.5) {

               totalScholarshipGPA = totalScholarshipGPA + studentsGPA[i];
           }
       }

  
       averageScholarshipGPAPercentage = totalScholarshipGPA/studentsGPA.length;
       System.out.println("The average GPA of the students with scholarship: "+averageScholarshipGPAPercentage);

       //Compute average GPA of without scholarship students
       for(int i=0;i<studentsGPA.length;i++) {
           if(studentsGPA[i]<3.5) {

               totalNonScholarshipGPA = totalNonScholarshipGPA + studentsGPA[i];
           }
       }

  
       averageNonScholarshipGPAPercentage = totalNonScholarshipGPA/studentsGPA.length;
       System.out.println("The average GPA of the students without scholarship: "+averageNonScholarshipGPAPercentage);

   }

}