Advertisement
AnitaN

05.ConditionalStatementsHomework/02.BonusScore

Mar 29th, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. //Problem 2.    Bonus Score
  2. //Write a program that applies bonus score to given score in the range [1…9] by the following rules:
  3. //•   If the score is between 1 and 3, the program multiplies it by 10.
  4. //•   If the score is between 4 and 6, the program multiplies it by 100.
  5. //•   If the score is between 7 and 9, the program multiplies it by 1000.
  6. //•   If the score is 0 or more than 9, the program prints “invalid score”.
  7.  
  8. using System;
  9.  
  10. class BonusScore
  11. {
  12.     static void Main()
  13.     {
  14.         Console.Write("Please,enter score:");
  15.         int score = int.Parse(Console.ReadLine());
  16.         int bonusScore;
  17.         if (score >= 1 && score <= 3)
  18.         {
  19.             bonusScore = score * 10;
  20.             Console.WriteLine("The score is {0} and the bonus score is {1}", score, bonusScore);
  21.         }
  22.         else if (score >= 4 && score <= 6)
  23.         {
  24.             bonusScore = score * 100;
  25.             Console.WriteLine("The score is {0} and the bonus score is {1}", score, bonusScore);
  26.         }
  27.         else if (score >= 7 && score <= 9)
  28.         {
  29.             bonusScore=score*1000;
  30.             Console.WriteLine("The score is {0} and the bonus score is {1}", score, bonusScore);
  31.         }
  32.         else
  33.         {
  34.             Console.WriteLine("The score {0} is Invalid score.",score);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement