Advertisement
Guest User

Prix2

a guest
Mar 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.  
  2. public class Prix {
  3.    
  4.     private static double total = 8, extraFromage = 1.50, extraViande = 2, qteLegume = 0, prixLegume = 0.50, extraSauce = 1.50;
  5.     private final double base = 8;
  6.    
  7.     public Prix(){
  8.         total = base;
  9.     }
  10.    
  11.     public static double getTotal(){;
  12.         return total;
  13.     }  
  14.    
  15.     public static void addExtraSauce(){
  16.         total += extraSauce;
  17.     }
  18.    
  19.     public static void removeExtraSauce(){
  20.         total -= extraSauce;
  21.     }
  22.    
  23.     public static void addExtraLegume(){
  24.         total += (qteLegume * prixLegume);
  25.     }
  26.    
  27.     public static void removeExtraLegume(){
  28.         total -= (qteLegume * prixLegume);
  29.     }
  30.    
  31.     public static void addExtraViande(){
  32.         total += extraViande;
  33.     }
  34.    
  35.     public static void removeExtraViande(){
  36.         total -= extraViande;
  37.     }
  38.    
  39.     public static void addExtraFromage(){
  40.         total += extraFromage;
  41.     }
  42.    
  43.     public static void removeExtraFromage(){
  44.         total -= extraFromage;
  45.     }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement