Question: Create a Java Program to complete the following: Note: Follow the requirements below to complete the project. You have to complete this home work before
Create a Java Program to complete the following:
Note: Follow the requirements below to complete the project.
You have to complete this home work before you come to next class as you need this for next class Lab
Your application should find GPA of of a student.
1.Create StudentDetail.java class. Do not need to include main method while creating this class
Create variables following variables in this class
studentName, studentId , scoreMath,scoreScience,scoreHistory,scoreEnglish,stuTotal , stuAverage,stuGPA
Add getters and setters for these variables
2.Create Student class. Include main method while creating this class
3.Create StudentHelper class. Do not need to include main method while creating this class.
This class should have calculateGPA() method.
This method should be able to receive StudentDetail object and return StudentDetail object
4.From Student class's main method, using JOptionPane, ask user to enter Student's name, Students's Id, scores in 4 subjects one by one and save them all in StudentDetail object (using the set methods)
Create an object for StudentHelper class.
Using this object, call calculateGPA() method of StudentHelper an send StudentDetail object.
5.In calculateGPA(), get the scores of 4 subjects one by one from StudentDetail object,calculate total ,average and GPA, save them in the StudentDetail object.
6.In main method of Student class, after receiving StudentDetail object from calculateGPA() method, using JOptionPane, display, student name,id and GPA using this StudentDetail object.
Also do the following:
1.With example, explain the difference between reference and primitive variable.
2.________________ operator is used to create a class object
3.In a Java project, ClassA has methodA() .
Write the 2 lines of Java code that you would need in ClassB to create an object for ClassA to access its method methodA()
4. Write about any 2 methods that belong to String class
5. What does the following code do?
String str = "12345";
int n = Integer.ParseInt(str);
6.The class JOptionPane is contained in the package -------------------
7. The class Scanner is contained in the package -----------------------
8 In Java , we can have else statement without if (True/false)
9. When will the following expression be true
!(x>0)
10. What is the output of the following code
if(5<=5)
System.out.print("true");
else
System.out.print("false");
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
