Advertisement
jezzye13

Scenario 1-1 Discount

Aug 18th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. //Rextester.Program.Main is the entry point for your code. Don't change it.
  2. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text.RegularExpressions;
  8.  
  9. namespace Rextester
  10. {
  11.     public class Program
  12.     {
  13.         public static void Main(string[] args)
  14.         {
  15.             //Your code goes here
  16.             Console.WriteLine("Hello, world!");
  17.            
  18.             int numberOfItems = 8;
  19.             discount(numberOfItems);
  20.         }
  21.        
  22.         public static void discount(int q) {
  23.             if (q < 10) {
  24.                 printDiscount(5);
  25.             } else if (q < 50) {
  26.                 printDiscount(10);
  27.             } else if (q < 100) {
  28.                 printDiscount(15);
  29.             } else {
  30.                 printDiscount(20);
  31.             }
  32.         }
  33.                
  34.         public static void printDiscount(int dis) {
  35.             Console.WriteLine("Your discount will be {0}%", dis);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement