• Matéria: Informática
  • Autor: elizangelapimenta
  • Perguntado 6 anos atrás


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?
VianaSZ19: e eh em qual linguagem?
elizangelapimenta: pode ser em java, c, javascript
VianaSZ19: ta mas eu n entendi qual e a finalidade? n tem como eu completar o metodo sem saber oq a questão quer
elizangelapimenta: 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;
elizangelapimenta: Desculpe a pergunte não foi completa antes...
elizangelapimenta: 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;

Respostas

respondido por: VianaSZ19
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;

}


VianaSZ19: ta ai
Perguntas similares