31 Your program You will write a program that performs the c
3.1 Your program
You will write a program that performs the computation described in the article. Your program will allow the user to do this several times, should the user want to do so. The sample output below shows how the interaction will work.
3.2 Requirements
We have some specific requirements for how you write the program. Were trying to show you a way to write programs that is more organized and is typical of what professional programmers would do. Here are the requirements:
You should read all values in from the user as doubles, even though some of them are clearly well handled as integers.
You must use long variable names that clearly explain what the variable holds. (We know that this is a pain in terms of typing and makes layout of your statements more complicated. But this is more professional than using abbreviated names that are cryptic.)
Your program must have at least these three methods:
double promptAndReadDouble(String description)
This method is used to ask the user to enter the many data values needed to compute the value of the GroupOn deal. It uses its description argument as part of the prompt and reads in a double value that it returns. It doesnt check whether the value is in a particular range. It creates a new Scanner each time it is called (this is not efficient, but its simple to write). For example, the first line where the user enters a value is created by this call to the method:
double couponFaceValue = promptAndReadDouble(”coupon face value (dollars)”);
void computeAndDisplayGroupOnEstimate() This method handles one entire GroupOn estimate computation. It uses promptAndReadDouble to get all input from the user and prints all the computation results for one estimate. Notice that it compares the cost of acquiring customers with GroupOn to the normal cost in order to say whether the GroupOn might be worth it.
main() should print the welcome and goodbye lines and have a simple loop that calls compute- AndDisplayGroupOnEstimate() and asks the user whether to compute another estimate.
2
3.3 Sample Output
3
Formulas being talked about:
I have been reading with great interest (especially here) the stories of retailers sharing their experiences using Groupon. For those of you not familiar with Groupon, the company partners with local businesses to send a daily coupon e-blast to its members. The members who buy the coupon get 50 to 70 percent off on a product or service, and Groupon splits the proceeds with the retailer — usually leaving the retailer with about 20 to 25 cents on the dollar of retail value.
I have never seen anything that is both so celebrated and demonized at the same time. There has been talk that Groupon might be worth as much as $3 billion, and yet here are some blog comments from retailers who’ve tried the service:
“It is for desperate businesses.”
“The financials just can’t work out.”
“Groupon is the worst marketing ever.”
“We did Groupon. It was O.K. It brought in new customers — we kept most of them. But the margins are a killer.”
As a retailer who has used Groupon — as well as traditional advertising — to build my business, I’ve come to the conclusion that there’s a lot of misinformation out there. Is Groupon the worst marketing ever? Or is it the best marketing ever? Probably both. One thing is for sure: Groupon is a beast.
What else would you call something that can deliver 2,000 customers to your store? It’s a beast that can propel your business or smother it. It depends on your business. It also depends on you. Here are some key factors:
The first is the type of business you have. How many potential customers in your area don’t know about you? Do you have excess capacity? Can you handle a surge?
The second factor is about branding. Do you believe that by giving out a large discount you risk damaging your brand? It is a judgment call. I am sure that it is a bad idea in some cases.
And then there is the math, which may be the most important factor. I have seen it attempted many times — but if it is not done properly, it can result in very misleading conclusions.
Groupon is advertising. If you don’t need or believe in advertising, there is no reason to look at this. It costs money. Instead of writing a check for an ad, you are choosing to lose money on sales. This can wreak havoc on the brain cells of a good retailer who is always watching profit
margins. It can feel wrong, especially when the coupon customers don’t spend more than the amount of the coupon.
That is why it is critical to do the math. Math is cold and unemotional — and eye-opening. Unfortunately, it is much easier and much more accurate to do the math after you try the program, because you will not have to guess on as many numbers. There are eight key calculations you need to consider to determine whether this is a better advertising vehicle than something else you may already be doing:
1. Your incremental cost of sales — that is, the actual cost percentage for a new customer. If you are giving boat tours and have empty seats, your incremental costs for an additional customer are next to nothing. If you are selling clothes, your incremental costs might be 50 percent of the sale price. Food might be 40 percent. In any case, don’t include fixed costs that you would be incurring any way.
2. The amount of the average sale. If the coupon is for $75, will the customers spend more that that? I have seen more than one retailer complain that nobody spends more than the value of the coupon. That’s unlikely but I am sure it can feel that way, and that is my point: Keep track.
3. Redemption percentage. You don’t really know until the end, but from my experience and from what I have heard, 85 percent is a good guess.
4. Percentage of your coupon users who are already your customers. I’m sure this number varies tremendously depending on the size of your city, how long you have been around, and the type of business.
5. How many coupons does each customer buy? (The more they buy, the fewer people are exposed to your product or service.)
6. What percentage of coupon customers will turn into regular customers? Again, it can seem as if they are all bargain shoppers who will never return without a discount, but that’s almost impossible. Is it possible 90 percent won’t return? Sure.
7. What is the advertising value of having your business promoted to 900,000 people — that’s the number on Groupon’s Chicago list — even if they don’t buy a coupon?
8. How much does it normally cost you to acquire a customer through advertising? Everything is relative.
Let’s look at an example of how this might work for a restaurant. Suppose you sell 3,000 coupons with a face value of $75 for $35. Then let’s assume the following:
1. 40 percent incremental costs (mostly food).
2. $85 average ticket ($10 more than the coupon). 3. 85 percent redeemed.
4. 40 percent used by existing customers.
5. Two bought per customer.
6. 10 percent come back again — or send friends.
7. $1,000 advertising value.
8. $125 typical cost to get a new customer through other advertising methods.
Now, let’s do the math:
Number redeemed: 3,000 x 85 percent = 2,550.
Revenue:
3,000 x $35 x 50 percent = $52,500 (Groupon sends a check).
2,550 x additional $10 = $25,500 (additional money spent by each customer).
total revenue = $78,000 (plus, you also get the $1,000 advertising value of having all those people introduced to your product or service).
Expense:
2,550 x $85 (average retail value) x 40 percent incremental cost = $86,700.
In this example, the restaurant took in $78,000 at a cost of $86,700, which means it cost $8,700 to run the deal. The key question is how many return customers the restaurant will get for that expense. If you divide the 2,550 total coupons by two (the average number of coupons bought by each customer), you get 1,275 customers. Multiply by 60 percent (to exclude existing customers) and you get 765. Multiply again by 10 percent (the percentage of new customers who return), and you get 76 new repeat customers.
Divide the $8,700 cost by 76 new customers, and the restaurant paid $114 for each new regular, which in this example is roughly what we assumed it would cost with conventional advertising. The question the restaurant has to answer is whether it was worth the trouble to get 76 customers — especially given that it probably annoyed some of its existing regulars. On the other hand, maybe it kept some of its employees busy when they otherwise would have had short hours.
But keep this in mind: because of the huge volume, if you change any of the variables, you can get very different results. For instance, if the customers had spent an average of $95 instead of $85, the restaurant would have actually made money on the promotion — something it’s almost impossible to do with traditional advertising. Of course, it goes the other way, too. If the customers spend only the $75 coupon amount, the cost to the restaurant will be $24,000 — an expense most owners probably never even consider.
Best marketing ever? Worst marketing ever? It all depends on a few little numbers. Here is the big difference between traditional advertising and Groupon: Traditional advertising requires spending some money and knowing that it can be lost if the ad doesn’t work. With Groupon, you spend no money up front but you mess with your formula for making money. You can win big and you can lose big.
It is a new world. The old math still works in it.
Solution
PROGRAM CODE:
package simple;
import java.util.Scanner;
public class GroupOnEstimator {
public static double promptAndReadDouble(String description)
{
double valueFromUser = 0.0;
System.out.print(\"Enter \" + description);
Scanner consoleReader = new Scanner(System.in);
valueFromUser = consoleReader.nextDouble();
return valueFromUser;
}
public static void computeAndDisplayGroupOnEstimate()
{
System.out.println(\"\");
double couponFaceValue = promptAndReadDouble(\"coupon face value (dollars): \");
double couponSalePrice = promptAndReadDouble(\"coupon sale price (dollars): \");
int numberOfCouponSold =(int) promptAndReadDouble(\"number of coupons sold: \");
double incrementalCostOfSales = promptAndReadDouble(\"incremental cost of sales (percent of sale price): \");
double amountOfAverageSales = promptAndReadDouble(\"amount of average sale (dollars): \");
System.out.println(\"\");
double redemptionPercentage = promptAndReadDouble(\"redemption percentage (percentage of coupons sold): \");
double percentageOfExistingUsers = promptAndReadDouble(\"percent of coupon users who are already customers: \");
double couponsPurchasedPerCustomer = promptAndReadDouble(\"number of coupons purchased per customer: \");
double percentageOfNewCustomers = promptAndReadDouble(\"percent coupon users who become customers: \");
System.out.println(\"\");
double advertisingValueOfCouponOffer = promptAndReadDouble(\"advertising value of coupon offer (in Chicago): \");
double normalCostToAcquireCustomer = promptAndReadDouble(\"normal cost to acquire a customer through advertising: \");
int numberOfCouponsRedeemed = (int) (numberOfCouponSold * redemptionPercentage/100);
double totalRevenue = (numberOfCouponSold * couponSalePrice * (percentageOfExistingUsers/100 + percentageOfNewCustomers/100))
+ (numberOfCouponsRedeemed * (amountOfAverageSales - couponFaceValue));
double totalExpense = numberOfCouponsRedeemed * amountOfAverageSales * incrementalCostOfSales/100;
double netExpense = totalExpense - totalRevenue;
double numberOfNewCustomers = (numberOfCouponsRedeemed/couponsPurchasedPerCustomer) * (100-percentageOfExistingUsers)/100 * (percentageOfNewCustomers/100);
double costForGrouponPerCustomer = netExpense/numberOfNewCustomers;
System.out.println(\"\ Number of coupons redeemed = \" + numberOfCouponsRedeemed + \" Total revenue = $\" + totalRevenue);
System.out.println(\"\ Total expense = $\" + totalExpense + \" Net expense = $\" + netExpense);
System.out.println(\"Number of new customers = \" + numberOfNewCustomers);
System.out.println(\"Cost to acquire a new customer with GroupOn = $\" + costForGrouponPerCustomer);
if(normalCostToAcquireCustomer < costForGrouponPerCustomer)
System.out.println(\"CONCLUSION: GroupOn is clearly not better than conventional advertising!\ \");
else
System.out.println(\"CONCLUSION: GroupOn might be better than conventional advertising!\ \");
}
public static void main(String[] args)
{
System.out.println(\"\ Welcome to the GroupOn Restaurant Estimator\");
Scanner reader = new Scanner(System.in);
char choice = \'y\';
while(choice == \'y\')
{
computeAndDisplayGroupOnEstimate();
System.out.print(\"Do you want to compute another GroupOn estimate (y/n)? : \");
choice = reader.next().charAt(0);
}
System.out.println(\"Goodbye!\");
}
}
OUTPUT:
Welcome to the GroupOn Restaurant Estimator
Enter coupon face value (dollars): 75
Enter coupon sale price (dollars): 35
Enter number of coupons sold: 3000
Enter incremental cost of sales (percent of sale price): 40
Enter amount of average sale (dollars): 85
Enter redemption percentage (percentage of coupons sold): 85
Enter percent of coupon users who are already customers: 40
Enter number of coupons purchased per customer: 2
Enter percent coupon users who become customers: 10
Enter advertising value of coupon offer (in Chicago): 1000
Enter normal cost to acquire a customer through advertising: 125
Number of coupons redeemed = 2550 Total revenue = $78000.0
Total expense = $86700.0 Net expense = $8700.0
Number of new customers = 76.5
Cost to acquire a new customer with GroupOn = $113.72549019607843
CONCLUSION: GroupOn might be better than conventional advertising!
Do you want to compute another GroupOn estimate (y/n)? : y
Enter coupon face value (dollars): 75
Enter coupon sale price (dollars): 35
Enter number of coupons sold: 3000
Enter incremental cost of sales (percent of sale price): 40
Enter amount of average sale (dollars): 95
Enter redemption percentage (percentage of coupons sold): 85
Enter percent of coupon users who are already customers: 40
Enter number of coupons purchased per customer: 2
Enter percent coupon users who become customers: 10
Enter advertising value of coupon offer (in Chicago): 1000
Enter normal cost to acquire a customer through advertising: 125
Number of coupons redeemed = 2550 Total revenue = $103500.0
Total expense = $96900.0 Net expense = $-6600.0
Number of new customers = 76.5
Cost to acquire a new customer with GroupOn = $-86.27450980392157
CONCLUSION: GroupOn might be better than conventional advertising!
Do you want to compute another GroupOn estimate (y/n)? : y
Enter coupon face value (dollars): 75
Enter coupon sale price (dollars): 35
Enter number of coupons sold: 3000
Enter incremental cost of sales (percent of sale price): 50
Enter amount of average sale (dollars): 85
Enter redemption percentage (percentage of coupons sold): 85
Enter percent of coupon users who are already customers: 40
Enter number of coupons purchased per customer: 2
Enter percent coupon users who become customers: 10
Enter advertising value of coupon offer (in Chicago): 1000
Enter normal cost to acquire a customer through advertising: 125
Number of coupons redeemed = 2550 Total revenue = $78000.0
Total expense = $108375.0 Net expense = $30375.0
Number of new customers = 76.5
Cost to acquire a new customer with GroupOn = $397.05882352941177
CONCLUSION: GroupOn is clearly not better than conventional advertising!
Do you want to compute another GroupOn estimate (y/n)? : n
Goodbye!






