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

The Williamsburg Women\'s Club offers scholarships to local high school students

ID: 3557583 • Letter: T

Question

The Williamsburg Women's Club offers scholarships to local high school students who meet any of several criteria. Write an application that prompts the user for a student's numeric high school grade point average (for example, 3.2), the student's number of extracurricular activities, and the student's number of service activities. Display the message "Scholarship candidate" if the student has any of the following:

- A grade point average of 3.8 or above at least one extracurricular activity and one service activity.

- A grade point average below 3.8 but at least 3.4 and a total of at least three extracurricular and service activities.

- A grade point average below 3.4 but at least 3.0 and at least two extracurricular activities and three service activities.

- If the student does not meet any of the qualification criteria, display "Not a candidate."

B. Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appears.

The first part is below. I need help with part B. Thanks!

import java.util.Scanner;
public class Scholarship2
{
   public static void main(String[] args)
   {
      Scanner sin = new Scanner(System.in);
      float averageGrade = 0;
      int extraActivities = 0;
      int extraService = 0;
      System.out.println("Enter high school grade point average: ");
      averageGrade=sin.nextFloat();
     System.out.println("Enter number of extracurricular activities: ");
      extraActivities=sin.nextInt();
      System.out.println("Enter number of service activities: ");
      extraService=sin.nextInt();
       if (averageGrade >= 3.8 && extraActivities >= 1 && extraService >= 1)
         {
            System.out.println("Scholarship Candidate");
         }
            if (averageGrade >= 3.4 && extraActivities >= 3 && extraService >= 3)
            {
               System.out.println("Scholarship Candidate");
            }
            else
            {
               System.out.println("Not a Scholarship Candidate");
            }
               if (!(averageGrade >= 0 || !(averageGrade <= 4.0)) || (!(extraActivities <= 1 || !(extraService >= 3))))
               {
                  System.out.println("Invalid Entry");

Explanation / Answer

import java.util.Scanner;
import java.io.*;
public class Scholarship2 {

public static void main(String[] args) {

Scanner sin = new Scanner(System.in);
float averageGrade=0;
int extraActivities=0,extraService=0;
System.out.println("Enter numeric high school grade point average");
averageGrade=sin.nextFloat();
System.out.println("Enter number of extracurricular activities");
extraActivities=sin.nextInt();
System.out.println("Enter number of service activities");
extraService=sin.nextInt();
if(averageGrade>4.0 ||averageGrade < 0||extraActivities<0|| extraService<0){
System.out.println("Inavlid Entry");
}
else if(averageGrade>=3.8 && extraActivities>=1 && extraService>=1)
{
System.out.println("Scholarship candidate");
}
else if(averageGrade>=3.4 && (extraActivities + extraService)>=3)
{
System.out.println("Scholarship candidate");
}
else if(averageGrade>=3.0 && extraActivities>=2 && extraService>=3)
{
System.out.println("Scholarship candidate");
}
else
{
System.out.println("Not scholarship candidate");
}
}
  
}

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