Advertisement
LePetitGlacon

Exercice 3

Sep 9th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace a
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.            
  10.             string produit1, produit2, produit3;
  11.             double prix1, prix2, prix3, prix11, prix22, prix33, totalHT, total1, total2, total3, totalTTC;
  12.            
  13.             //A partir d'une quantité de produits achetés à un prix unitaire hors taxe, on veut établir la facture d'un client.
  14.             //La facture fera apparaître le montant hors taxe
  15.                
  16.                 produit1 = "Baguette(s)" ; //Produits du jour
  17.                 produit2 = "Chocolat";
  18.                 produit3 = "Abricot(s)";
  19.                
  20.                 prix1 =  0.50; //Prix HT
  21.                 prix2 =  1.25;
  22.                 prix3 =  2.30;
  23.                
  24.                 Console.WriteLine("Nous avons ces produits : pain, chocolat, abricot ");
  25.                 Console.WriteLine("Indiquez le nombre de produit(s) que vous prenez : \n");
  26.                
  27.                
  28.                     Console.WriteLine(produit1);
  29.                     int nombreProduit1 = int.Parse(Console.ReadLine());
  30.                     Console.WriteLine(nombreProduit1 +" " + produit1+"\n");
  31.                
  32.                     Console.WriteLine(produit2);
  33.                     int nombreProduit2 = int.Parse(Console.ReadLine());
  34.                     Console.WriteLine(nombreProduit2 +" " + produit2 +"\n");
  35.                
  36.                     Console.WriteLine(produit3);
  37.                     int nombreProduit3 = int.Parse(Console.ReadLine());
  38.                     Console.WriteLine(nombreProduit3 +" " + produit3+"\n");
  39.                    
  40.                     prix11 = nombreProduit1 * prix1 * 0.2 + prix1 * nombreProduit1; //Prix TTC
  41.                     prix22 = nombreProduit2 * prix2 * 0.2 + prix2 * nombreProduit2;
  42.                     prix33 = nombreProduit3 * prix3 * 0.2 + prix3 * nombreProduit3;
  43.                    
  44.                         totalHT = nombreProduit1 * prix1 + nombreProduit2 * prix2 + nombreProduit3 * prix3;
  45.                         totalTTC = prix11 + prix22 + prix33;
  46.                             total1 = nombreProduit1 * prix1;
  47.                             total2 = nombreProduit2 * prix2;
  48.                             total3 = nombreProduit3 * prix3;
  49.                
  50.                 Console.WriteLine("~~~~FACTURE~~~~\n");
  51.                
  52.                 Console.WriteLine(produit1 + ": " + total1 + " euro(s)");
  53.                 Console.WriteLine(produit2 + ": " + total2 + " euro(s)");
  54.                 Console.WriteLine(produit3 + ": " + total3 + " euro(s)\n");
  55.                
  56.             Console.WriteLine("Total HT : " + totalHT + " euro(s)");
  57.             Console.WriteLine("Total TTC : " + totalTTC + " euro(s)");
  58.                    
  59.         Console.ReadKey(true);
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement