Advertisement
LePetitGlacon

FICHE 4 Exercice 6 #2

Oct 1st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 KB | None | 0 0
  1. using System;
  2.  
  3. namespace p
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.            
  10.             int code;
  11.             float pourcentage;
  12.             Console.WriteLine("Quel est votre ancienneté (en années) ?");
  13.             int annee = int.Parse(Console.ReadLine());
  14.             Console.WriteLine("Quel est votre salaire (en euro) ?");
  15.             int salaire = int.Parse(Console.ReadLine());
  16.            
  17.             if (annee < 2 && salaire < 60000)
  18.             {
  19.                 code = 1;
  20.                 pourcentage = 0f;
  21.             }
  22.             else
  23.             {
  24.                 if ((annee < 5 && salaire < 100000) || (annee >= 5 && salaire < 60000))
  25.                 {
  26.                     code = 2;
  27.                     pourcentage = 1f;
  28.                 }
  29.                 else
  30.                 {
  31.                     if ((annee >= 5 && (salaire >= 60000 && salaire < 100000)) || (annee < 2 && salaire >= 100000))
  32.                     {
  33.                         code = 3;
  34.                         pourcentage = 1.5f;
  35.                     }
  36.                    
  37.                     else
  38.                     {
  39.                         if ((annee >= 2 && annee < 5) && salaire >= 100000)
  40.                         {
  41.                             code = 4;
  42.                             pourcentage = 2f;
  43.                         }
  44.                         else
  45.                         {
  46.                             code = 5;
  47.                             pourcentage = 2.5f;
  48.                         }
  49.                     }
  50.                 }  
  51.             }
  52.             Console.WriteLine("Votre code est {0}, vous aurez donc une remise de {1} %",code,pourcentage);
  53.             Console.ReadKey();
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement