A supermarket awards coupons depending on how much a


A supermarket awards coupons depending on how much a customer spends on groceries.

For example, if you spend $50, you will get a coupon worth eight percent of that amount.

The following table shows the percent used to calculate the coupon awarded for different amounts spent.

Write a program that calculates and prints the value of the coupon a person can receive based on groceries purchased.

Here is a sample run:

Please enter the cost of your groceries: 14

You win a discount coupon of $ 1.12. (8% of your purchase)

import java.util.Scanner;

/**

* Code for E5.25

* @author

*/

public class GroceryDiscount

{

public static void main(String[] args)

{

Scanner in = new Scanner(System.in);

System.out.print("Please enter the cost of your groceries: ");

double bill = in.nextDouble();

double coupon = 0;

// Your work goes here

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: A supermarket awards coupons depending on how much a
Reference No:- TGS02932490

Expected delivery within 24 Hours