public static void main(String[] args) { CarDealer dealer1 = new CarDealer("Grandeur", 3500, 10); CarDealer dealer2 = new CarDealer("Genesis", 5500, 5); CarBuyer buyer = new CarBuyer(); buyer.buyCar(dealer1, 3500); buyer.buyCar(dealer2, 5500); dealer1.saleResult(); dealer2.saleResult(); buyer.buyResult(); }
public void buyCar(CarDealer dealer, int price) { owner = dealer.carSale(price); money -= price; }