In: Computer Science
Using C++, create a program that will input the 3 game
scores of a player and then output the level of the player with a
message.
Specifications
Prompt the user to input 3 game scores (double values).
Compute the weighted average (DO NOT JUST ADD AND DIVIDE BY
3!) score as follows:
20% for first game, 30% for second game, 50% for last game
Earlier games are worth less in the weighted average; later games
are worth more.
Print the level of the player expertise based on the weighted
average as follows:
average >= 2000: expert
average is >= 1800 but is < 2000 master
average is >= 1500 but is < 1800: advanced
average is >=1000 but is <
1500: intermediate
average < 1000: beginner
For each expert player print:
"Congratulations! You are an expert! "
For each player that
is master or advanced print:
"Good Job!"
For each player that is a beginner: "Keep on
practicing!"
Run the program 2 times on the following input:
Run 1:
600 1500 900
Run 2:
1800 1500 2000
#include<iostream>
using namespace std;
int main()
{
double s1,s2,s3,avg;
cout<<"Please enter the values of game scores
:";
cin>>s1>>s2>>s3;
avg = (s1*0.2)+(s2*0.3)+(s3*0.5); //
Computing weighted average according to the game weightage
if(avg >= 2000)
{
cout<<"Expert\n";
cout<<"Congratulations! You
are an expert! \n";
}
else if(avg >= 1800 && avg < 2000)
{
cout<<"Master\n";
cout<<"Good Job!\n";
}
else if(avg >= 1500 && avg < 1800)
{
cout<<"Advanced\n";
cout<<"Good Job!\n";
}
else if(avg >= 1000 && avg < 1500)
{
cout<<"Intermediate\n";
}
else if(avg < 1000)
{
cout<<"Beginner\n";
cout<<"Keep on
practicing!\n";
}
return 0;
}
Sample run# 1
600 1500 900
output : Intermediate
Sample run# 2
1800 1500 2000
output :Master
Good Job!