Advertisement
solidsnake

Untitled

Apr 22nd, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. CUSTOMER
  2. namespace Exercise
  3. {
  4.     public class Customer
  5.     {
  6.         private String firstName;
  7.         private String lastName;
  8.  
  9.         public void setName(String firstName, String lastName)
  10.         {
  11.             this.firstName = firstName; //corresponds to the first class
  12.             this.lastName = lastName;
  13.         }
  14.         public String getName()
  15.         {
  16.  
  17.         }
  18.         public void printName()
  19.         {
  20.             Console.WriteLine(lastName + "," + firstName);
  21.             //Console.ReadKey();
  22.         }
  23.        
  24.     }
  25. }
  26.  
  27. MAIN METHOD
  28. namespace Exercise
  29. {
  30.     class Program
  31.     {
  32.         static void Main(string[] args)
  33.         {
  34.             Customer customer1 = new Customer();
  35.             customer1.setName("Solid,", "Snake");
  36.  
  37.             BankAccount b = new BankAccount();
  38.             b.setCustomer(customer1);
  39.             b.setBalance(2000);
  40.             Console.WriteLine("Customer" + b.getCustomer().getName() + " has a balance of " + b.getBalance();
  41.         }
  42.     }
  43. }
  44.  
  45. BANK ACCOUNT
  46. namespace Exercise
  47. {
  48.     public class BankAccount
  49.     {
  50.         private float balance = 0;
  51.         private Customer customer = 0;
  52.  
  53.         public void setBalance(float balance)
  54.         {
  55.             this.balance = balance;
  56.         }
  57.        
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement