Solved

Posted on 2009-05-16
169 Views
assignment is to write two more overloaded methods to change the cut
off level for B to be 75; and change cut off level for C to be 65.

Thus, your program will have four overloaded methods.

First method: takes 3 arguments. This is already done.

Second overloaded method: takes four arguments: three scores and new cut off
score for A (85). This is already done.

Third overloaded method: takes five arguments: three scores, new cut off score
for A (85), and new cut off score for B (75). You need to write this.

Fourth overloaded method: takes six arguments: three scors, new cut off
score for A (85), new cut off score for B (75), and new cut off score for C
(65). You have to write this.

``````import java.util.*;

{

public static void main(String args[]){

int score1, score2, score3;

System.out.println("Input three exam score");

Scanner input = new Scanner(System.in);

score1 = input.nextInt();

score2 = input.nextInt();

score3 = input.nextInt();

}

//Invokes this method if the number of arguments is 3

static void getGrade(int s1, int s2, int s3){

int sum = s1+s2+s3;

int average =(int)(sum/3);

System.out.println("Grade using the original scheme");

if(average >= 90) System.out.println("Grade is A");

else if(average >= 80) System.out.println("Grade is B");

else if(average >= 70) System.out.println("Grade is C");

else if(average >= 60) System.out.println("Grade is D");

else System.out.println("Grade is F");

}

//Invokes this method if the number of arguments is 4

static void getGrade(int s1, int s2, int s3, int Alevel){

int sum = s1+s2+s3;

int average =(int)(sum/3);

System.out.println("Grade using the new scheme - Cut off for A is 85");

if(average >= Alevel) System.out.println("Grade is A");

else if(average >= 80) System.out.println("Grade is B");

else if(average >= 70) System.out.println("Grade is C");

else if(average >= 60) System.out.println("Grade is D");

else System.out.println("Grade is F");

}

}
``````
0
Question by:USN4x4

LVL 11

Accepted Solution

climbgunks earned 500 total points

It's a class assignment.  I can give general help only.

Basically you need to create two new getGradeFunctions().  The first will have an addition Blevel argument, and the second will have both an additional Blevel and Clevel argument.   Replace the B cutoff (8) with the Blevel argument and simliarly for C (70 -> Clevel).

Otherwise, the code is the same as shown in the last function above.

0

LVL 3

Expert Comment

Overloading just means the same function or contructor with different arguements, for example
``````public overloadedConstructor()

{

}

{

}

public overloadedConstructor(int i, String s)

{

}
``````
0

## Join & Write a Comment Already a member? Login.

### Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

#### 728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!