Advertisement
AnitaN

05.ConditionalStatementsHomework/02.1.BonusScoreVariant

Mar 29th, 2014
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. //Problem 2.    Bonus Score ... Variant with case
  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. using System;
  8.  
  9. class BonusScoreVariant
  10. {
  11.     static void Main()
  12.     {
  13.         Console.Write("Please, enter score from 1 to 9:");
  14.         int score =int.Parse(Console.ReadLine());
  15.         switch (score)
  16.         {
  17.             case 1:
  18.             case 2:
  19.             case 3:
  20.                 Console.WriteLine("The bonus is {0}",score*10);
  21.                 break;
  22.             case 4:
  23.             case 5:
  24.             case 6:
  25.                 Console.WriteLine("The bonus is {0}",score*100);
  26.                 break;
  27.             case 7:
  28.             case 8:
  29.             case 9:
  30.                 Console.WriteLine("The bonus is {0}",score*1000);
  31.                 break;
  32.             default:
  33.                 Console.WriteLine("You enter wrong score.Please, try again");
  34.             break;
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement