Market differentiation in its simplest form is a system of charging different
prices to different customers for the same product. To maximize the total
sales revenue, we would like to charge each customer individually, charging the
highest price that that customer would be willing to pay. Usually we have
to divide the customers into a few groups, and charge the same
price to everyone in a group (e.g. business class, economy class, etc.).
We have a list of all the potential customers for our product and the most
that each customer is willing to pay. We have decided to differentiate them
into four or fewer (nonoverlapping) groups. Everyone within each group
will be offered the same price. Our goal is to choose the groups and prices
optimally to maximize our total sales revenue.
Create a class Pricing that contains a method maxSales that takes a int[]
price containing the highest price that each potential customer is willing
to pay, and returns the maximum sales revenue we can generate by
differentiating our customers into four or fewer groups.
