LePetitGlacon

FICHE 4 Exercice 5 #2

Sep 30th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 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.             float prixHeure, prixTotal;
  10.                
  11.                
  12.             Console.WriteLine("Permis [A] ou [B] ?");
  13.             string permis = (Console.ReadLine());
  14.            
  15.             if (permis == "A")
  16.             {
  17.                 prixHeure = 45;
  18.             }
  19.             else
  20.             {
  21.                 prixHeure = 50;
  22.             }
  23.             prixTotal = prixHeure;
  24.             Console.WriteLine("Quels jours vas-tu y aller :\nlundi\nmardi\nmercredi\njeudi\nvendredi\nsamedi");
  25.             string jour = (Console.ReadLine());
  26.            
  27.             if (jour == "lundi" || jour == "samedi")
  28.                 {
  29.                     prixTotal = prixHeure;
  30.                 }
  31.                 else   
  32.                 {
  33.                     if (jour == "mercredi" || jour == "vendredi")
  34.                     {
  35.                        
  36.                         prixTotal = prixTotal - (prixHeure * 0.2f);
  37.                     }
  38.                     else
  39.                     {
  40.                         if (jour == "mardi")
  41.                         {
  42.                            
  43.                             prixTotal = prixTotal - (prixHeure * 0.1f);
  44.                         }
  45.                             else
  46.                             {
  47.                                 if (jour == "jeudi")
  48.                                 {
  49.                                    
  50.                                     prixTotal = prixTotal - (prixHeure * 0.05f);
  51.                                 }
  52.                     }
  53.                 }  
  54.             }
  55.                 prixTotal = prixTotal - (prixTotal * 0.08f);
  56.                 Console.WriteLine("Le prix de la séance sera de {0} euros",prixTotal);
  57.                 Console.ReadKey(true);
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment