The Williamsburg Women’s Club offers scholarships to local high school students
ID: 670599 • 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:
l A grade point average of 3.8 or above and at least one extracurricular activity and one service activity
l A grade point average below 3.8 but at least 3.4 and a total of at least three extracurricular and service activities
l A grade point average below 3.4 but at least 3.0 and at least two extracurricular activities and three service activities
Making Decisions
If the student does not meet any of the qualification criteria, display “Not a candidate.” Save the file as Scholarship.java.
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. Save the file as Scholarship2.java.
Explanation / Answer
public static void main(String arg[])
{
Testy tst=new Testy();
tst.processGrades();
}
public void processGrades()
{
if
(score >=3.8)
{
System.out.println("Your grade is A");
System.out.println("one at least one extracurricular activity and one service activity");
}
else
if
((score >= 3.8)&&( score <3.4 ))
{
System.out.println("Your grade is B");
System.out.println("at least three extracurricular and service activities");
}
else
((score >=3.0 )&&(score<3.4))
{
System.out.println("Your grade is C");
System.out.println("at least two extracurricular activities and three service activities");
}
else
if
(score <3.0 )
{
System.out.println(" Not a candidate.” Save the file as Scholarship.java.");
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.