I have to write a complete program that prompts the user for a student’s status
ID: 3793974 • Letter: I
Question
I have to write a complete program that prompts the user for a student’s status and grade point average ( GPA ) and then I have to determine whether or not the student should be placed on the Dean’s list. I have to assume that a student is placed on the Dean’s list when he / she has full - time status and a GPA of at least 3.50 and the part - time students cannot be placed on the Dean’s list regardless of their GPA.
This is what I have so far but not sure if am right:
import java.util.Scanner;
public class HomeworkPart4
{
public static void main(String[] args)
{
Scanner sin = new Scanner(System.in);
float gradeAverage = 0;
int studentStatus = 0;
System.out.println("Enter student's status: ");
studentStatus = sin.nextInt();
System.out.println("Enter grade point aveage (GPA)");
gradeAverage = sin.nextFloat();
Thank you for your time.
Explanation / Answer
Hi, Please find my program.
Please let me know in case of any issue.
import java.util.Scanner;
public class HomeworkPart4
{
public static void main(String[] args)
{
Scanner sin = new Scanner(System.in);
float gradeAverage = 0;
int studentStatus = 0;
System.out.println("Enter student's status(1-for full time, 0-part time): ");
studentStatus = sin.nextInt();
System.out.println("Enter grade point aveage (GPA)");
gradeAverage = sin.nextFloat();
if(studentStatus == 1){
if(gradeAverage >= 3.5){
// put the student in Dean's list
System.out.println("You can be in the Dean's list");
}else{
System.out.println("You can not be in the Dean's list");
}
}else{
System.out.println("You can not be in the Dean's list");
}
}
}
/*
Sample run:
Enter student's status(1-for full time, 0-part time):
1
Enter grade point aveage (GPA)
2.4
You can not be in the Dean's list
Enter student's status(1-for full time, 0-part time):
1
Enter grade point aveage (GPA)
4
You can be in the Dean's list
Enter student's status(1-for full time, 0-part time):
0
Enter grade point aveage (GPA)
4.5
You can not be in the Dean's list
*/