Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
2
Indexable
Never
package panganiban_lab2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Panganiban_Lab2 {
    public static void main(String[] args) throws IOException{
        InputStreamReader isr = new InputStreamReader (System.in);
        BufferedReader br = new BufferedReader(isr);
        Student stud = new Student();
        
        System.out.print("Enter your name: ");
        stud.name = br.readLine();
        System.out.print("Enter your student number: ");
        stud.studNum = Integer.parseInt(br.readLine());
        System.out.print("Enter your course: ");
        stud.course = br.readLine();
        System.out.print("Enter your GPA: ");
        stud.gpa = Float.parseFloat(br.readLine());
        
        System.out.println("");
        System.out.println("Expected Output:");
        System.out.println("Name: " + stud.name);
        System.out.println("Student Number: " + stud.studNum);
        System.out.println("Course: " + stud.course);
        System.out.println("GPA: " + stud.gpa);
        System.out.println("");
        
        if (stud.gpa >= 1 && stud.gpa <= 3){
            System.out.println("Congratulations! You passed!");
        } else {
            System.out.println("You failed!");
        }
        
    }
    

}