0

Help me, I cannot continue the lesson in C# Intermediate.

In the "Operator Overloading" lesson, I was given a code coach where I had to overload the operator to calculate the score for each team. When I compile, it works, but the result is wrong. And I can't see the test case because it's hidden. Here's my code: https://sololearn.com/compiler-playground/c3063MSPyl8s/?ref=app

12th Feb 2024, 11:06 AM
YuukiC (INACTIVE)
YuukiC (INACTIVE) - avatar
3 Answers
+ 1
Here's the task: You and your friend are playing a game as one team. Each player must pass 2 rounds and gets points for each round passed. The program you are given creates two Score objects where each round scores are stored (they are passed to a constructor). Overload the + operator for the Score class to calculate the team score for every round.
12th Feb 2024, 10:56 PM
YuukiC (INACTIVE)
YuukiC (INACTIVE) - avatar
0
It looks to me like you're adding each player's round scores, i.e., player 1 round 1 + player 1 round 2. Is that the task? Or is to add both player's round together, i.e., player 1 round 1 + player 2 round 1?
12th Feb 2024, 3:33 PM
Ausgrindtube
Ausgrindtube - avatar
0
Thanks for that. So it should be the second equation I wrote, not the one you've calculated.
13th Feb 2024, 7:53 AM
Ausgrindtube
Ausgrindtube - avatar