Question: Consider the Customer class defined in Customer.java, which contains a double money variable. Add an isRicherThan(Customer other) method to the class that returns true if
Consider the Customer class defined in Customer.java, which contains a double money variable. Add an isRicherThan(Customer other) method to the class that returns true if the calling Customer has more money than the Customer specified as an argument. Write a static findRichest(Customer[] customers) method that returns the Customer from the argument array that has the most money. Note: you do not need to handle the case of ties.
public class Customer{ double money; public Customer(){ this(0.0); } public Customer(double initMoney){ money = initMoney; } public double getMoney(){ return money; } public void setMoney(double newMoney){ money = newMoney; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
