in this challenge, the task is to implement a function tipPercentage that:
take 1 argument: rating, a string; returns the number of percentage of the given ratings: if rating is Terrible or Poor, then returns 3; if rating is Good or Great, then returns 10; if rating is Excellente, then returns 20; if rating is none of the above, then returns 0;
* Complete the 'tipPercentage' function below.
*
* The function is expected to return an INTEGER.
* The function accepts STRING rating as parameter.
*/
int tipPercentage(string rating) {
}
VianaSZ19:
como assim? mas oqq a questão quer afinal?? qual eh o objetivo?
Respostas
respondido por:
2
int tipPercentage(string rating) {
if(rating.Equals("Terrible") || rating.Equals("Poor")){
return 3;
}else if(rating.Equals("Good") || rating.Equals("Great")){
return 10;
}else if(rating.Equals("Excelent")){
return 20;
}
return 0;
}
Perguntas similares
5 anos atrás
5 anos atrás
7 anos atrás
7 anos atrás
7 anos atrás
8 anos atrás