Part 1: Gather the Input You are going to create a working program that will det
ID: 671602 • Letter: P
Question
Part 1: Gather the Input You are going to create a working program that will determine if a student’s academic progress. The program will tell them if they need an extra semester, not ready to graduate or is in academic probation. Create variables for the following:
GPA Total Credits Taken Number of Math and Science Credits Number of Liberal Arts Credits Number of Major Elective Credits Boolean variable called canGraduate (initialized to true) Boolean variable called onProbation (initialized to false)
Create useful and user friendly prompts and get input from the user for each item.
Info: The student will graduate only if the following requirements are met: Minimum GPA of 2.0 Minimum total credits of 40 The user needs o Major Electives: at least 10 And either: o Math and Science credits total: at least 9 for BS o Liberal Arts credits total: at least 9 for BA
Part 2: Single Alterntive If Create a conditional to check if the GPA is less than 2.0. If it is, inform the student that they will be placed on Academic Probation and are not eligible to graduate and set onProbation to be true.
Part 3: Double Comparison In this section we will write an If-Else based on how many credits have been taken. Write a conditional to check if the number of credits taken is over 40. If it is not, then tell the user they need to take more credits to be eligible for graduation. Set canGraduate to false. If the number of credits is over 40 then output “Examining credit breakdown…” and
Part 4’s code Part 4: Nested Logic This section will be nested inside the true clause of Part 3’s if-statement. Use an If-Else If-Else to determine if they are eligible for a BA or a BS. The Major Elective Credits are non-negotiable and apply to both. If the user has 10 or more Major Elective Credits and more than 9 Math and Science credits then output that the user is eligible for the Bachelors of Science. Else if the user has 10 or more Major Elective Credits and more than 9 Liberal Arts credits then output that the user is eligible for the Bachelors of Arts. Else output that the user is not meeting degree requirements and set canGraduate to false. Part 5: Final Output After the else clause of Part 3 … you will code your final conditionals. If the user is on probation (onProbation is true) or cannot graduate due to credit restraints (canGraduate is false) – output to the user that they need to continue work on their degree. Else output to the user congratulations on being in good academic standing and they are eligible to graduate.
Sample Run 1:
Hello, let’s check your academic progress!
Enter your GPA: 1.9
Enter your Total Credits: 24
Enter your Major Elective Credits: 10
Enter your Liberal Arts Credits: 5
Enter your Math and Science Credits: 9
Your GPA is only 1.9 – You are on academic probation
Your credit count is only 24 – You do not have enough credits to graduate
You need to continue to work on your degree
Sample Run 2:
Hello, let’s check your academic progress!
Enter your GPA: 3.9
Enter your Total Credits: 40
Enter your Major Elective Credits: 10
Enter your Liberal Arts Credits: 5
Enter your Math and Science Credits: 9
You have the necessary GPA and Credits
Examining credit breakdown …
You are eligible for a Bachelor’s of Science Congratulations, everything seems in order and you can graduate.
Sample Run 2:
Hello, let’s check your academic progress!
Enter your GPA: 3.9
Enter your Total Credits: 40
Enter your Major Elective Credits: 10
Enter your Liberal Arts Credits: 5
Enter your Math and Science Credits: 5
You have the necessary GPA and Credits
Examining credit breakdown …
You are not meeting degree requirements You need to continue to work on your degree
Explanation / Answer
import java.util.Scanner;
public class application {
public static void main(String[] args) {
double GPA;
int tCredits;
int nMS;
int lA;
int mE;
boolean cG=true;
boolean oP=false;
Scanner scan=new Scanner(System.in);
System.out.println("Hello,let's check your academic progress!");
System.out.print("Enter your GPA:");
GPA=scan.nextDouble();
System.out.print("Enter your Total Credits:");
tCredits=scan.nextInt();
System.out.print("Enter your Major Elective Credits:");
mE=scan.nextInt();
System.out.print("Enter your Liberal Arts Credits:");
lA=scan.nextInt();
System.out.print("Enter your Math and Science Credits:");
nMS=scan.nextInt();
if(GPA<2.0){
oP=true;
System.out.println("Your GPA is only "+GPA+"- You are on academic probation");
}
if(tCredits>=40){
System.out.println("Examining Credits break down......");
if(mE>=10&&nMS>=9){
System.out.println("You are eligible for a Bachelor’s of Science Congratulations, everything seems in order and you can graduate.");
}else if(mE>=10&&lA>=9){
System.out.println("You are eligible for a Bachelor’s of Arts Congratulations, everything seems in order and you can graduate.");
}else{
cG=false;
System.out.println("You are not meeting degree requirements You need to continue to work on your degree");
}
}else{
System.out.println("Your credit count is only "+tCredits+"- You do not have enough credits to graduate");
cG=false;
}
if(oP||!cG){
System.out.println("You need to continue to work on your degree");
}else{
System.out.println("congratulations on being in good academic standing and you are eligible to graduate. ");
}
}
}