In: Computer Science
Please use the following constructs in your program:
//GpaYear.java import java.util.Scanner; public class GpaYear { private double gpa; private int graduationYear; public GpaYear() { } public GpaYear(double gpa, int graduationYear) { this.gpa = gpa; this.graduationYear = graduationYear; } public double getGpa() { return gpa; } public void setGpa(double gpa) { this.gpa = gpa; } public int getGraduationYear() { return graduationYear; } public void setGraduationYear(int graduationYear) { this.graduationYear = graduationYear; } public static void main(String[] args) { GpaYear obj = new GpaYear(); Scanner scan = new Scanner(System.in); double gpa; int year; System.out.print("Enter gpa: "); gpa = scan.nextDouble(); System.out.print("Enter graduation year: "); year = scan.nextInt(); obj.setGpa(gpa); obj.setGraduationYear(year); System.out.println("GPA: "+obj.getGpa()); System.out.println("Graduation year: "+obj.getGraduationYear()); } }