Hello , I'm new with java and I have a work to do, but I don't understand anything :(
Can someone please help me ?

Create a program composed of two classes called: GradeCalculator (with main ( ) method ) and Student.
The Student class structure is presented below:


studentName : String
studentLastName : String
studentid, gradeGL1, gradeGL2 : int

Student(String,String) //constructor
calculatePercent() : double
checkPassing() : boolean

In the main method provide a user interface for inputing the values for a student. Display a warning if GLab values are in the wrong range.
Grades for both GLabs are between 0 to 100,
Conditions for passing:
A student must have received over 50 points in AT LEAST one G-Lab AND the total must be above 50 % .

Recommended Answers

All 5 Replies

If you really understand nothing then you may as well give up now. But I suspect you know more than that.
You have been told what to do step by step. Start at the beginning, do what you can, and when you get stuck post what you have done, and explain exactly what is stopping you.

public class GradeCalculator {

    public static void main(String[] args) {

        System.out.println("Enter your name:");
        System.out.println("Enter your last name:");
        System.out.println("Enter your ID:");
        System.out.print("Enter grade GL1:");
        System.out.print("Enter grade GL2:");
        Scanner input = new Scanner(System.in);
        double calculatePercent = input.nextInt();
        System.out.println("Your final result is:"+calculatePercent+"%");
        calculatePercent = (gradeGL1+gradeGL2)/2;
        if (calculatePercent<50){
        System.out.print("You didn't pass");
        if (calculatePercent>50)
        System.out.println("You pass");

package gradecalculator;
public class Student {
private final String Name;
   private final String LastName;
   private final int Id;
   private final int gradeGL1;
   private final int gradeGL2;
   private final double calculatePercent;
   private final boolean finalResult;

public Student(String Name, String LastName, int Id, int gradeGL1, int gradeGL2, double calculatePercent, boolean finalResult){
      this.Name = Name;
      this.LastName = LastName;
      this.Id = Id;
      this.gradeGL1 = gradeGL1;
      this.gradeGL2 = gradeGL2;
      this.calculatePercent = calculatePercent;
      this.finalResult = finalResult;

    public String getName() {
      return Name;
   public String getLastName() {
      return LastName;
    public int getId() {
      return Id;
    public int getgradeGL1(){
       return gradeGL1;
    public int getgradeGL2(){
       return gradeGL2;
    public String String(){
      return Name + "(" + LastName + ")" +Id;
    public double getcalculatePercent(){
    return calculatePercent;
    public boolean getfinalResult(){
    return finalResult;

OK, that's better. Here are some points to start with....

In your main you forgot to read in the user's input for name etc etc
You need to create an instance of Student using the values you read in from the user.
You did read in calculatePercent, but that's not user input, it's calculated
That calculation should be part of the Student class,, not in the main method

The only think that I can't do after that explanation is create an instance of Student. Gives me error. I put:
Student s = new Student ();
I need that the main method go take the values of the student class.

If you look at your Student calsss you will see the constructor, and so yournew... has to match that list of parameters.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.