Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1.     public class Appledevice
  2.     {
  3.         public Appledevice createDevice(String type, String color)
  4.         {
  5.  
  6.             AplleDevice device = null;
  7.  
  8.             if (type.Equals("Iphone"))
  9.             {
  10.                 if (color.Equals("White"))
  11.                 {
  12.                     device = new WhiteIphone();
  13.                 }
  14.  
  15.                 if (color.Equals("Golden"))
  16.                 {
  17.                     device = new GoldenIphone();
  18.                 }
  19.             }
  20.  
  21.             else if (type.Equals("Ipad"))
  22.  
  23.             {
  24.                 if (color.Equals("White"))
  25.                 {
  26.                     device = new WhiteIpad();
  27.                 }
  28.  
  29.                 if (color.Equals("Golden"))
  30.                 {
  31.                     device = new GoldenIpad();
  32.                 }
  33.             }
  34.  
  35.  
  36.             device.verifyPrice();
  37.             device.calculateDeliveryPrice();
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement