010-002-007
Method Overloading: Score Aggregation
Easy
Problem Description
method overloading: Score Aggregation
In this problem, you will create a program that defines three overloaded versions of the aggregateScore method with different argument counts and types, reads values from standard input, and displays the result of each calculation to standard output.
Learning Objective: Use overloading for both argument count and type differences
Create 3 types of score aggregation methods. Define 2-argument, 3-argument, and weighted versions.
Method Definitions
- aggregateScore(int, int): Sum of 2 scores
- aggregateScore(int, int, int): Sum of 3 scores
- aggregateScore(int, int, boolean): Weighted sum (double score2 if true)
Input
[score1] [score2]
[score1] [score2] [score3]
[score1] [score2] [isWeighted(true/false)]
Output
[2-arg result]
[3-arg result]
[weighted result]
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up