The Downtown Marketing Association wants to promote downtown shopping with a loy
ID: 3658385 • Letter: T
Question
The Downtown Marketing Association wants to promote downtown shopping with a loyalty program (after accumulating $100 in purchases, the customer recieves a $10 discount on the next purchase). Shops are identified by a number between 1 and 20. Add a new parameter variable to the makePurchase method that indicates the shop. The discount is awarded if a customer makes purchases in at least three different shops, spending a total of $100 or more.Explanation / Answer
import java.util.ArrayList; import java.util.Scanner; public class DowntownMarketing { public static void main(String[] args) { int shopNo; double amount = 0.0; int count = 0; int discount = 0; Scanner input = new Scanner(System.in); ArrayList shopList = new ArrayList (); do { System.out .println("Enter the shop no. (1 to 20) on which you want to do shopping (-1 to exit) :"); shopNo = input.nextInt(); if (shopNo >= 1 && shopNo < = 20) { System.out.println("Welcome to Shop No-" + shopNo); System.out.println("Enter the purchasing amount :"); amount = amount + input.nextDouble(); shopList.add(shopNo); } } while (shopNo != -1); for (int i = 1; i = 100 && count >= 3) { discount = 10; } System.out.println("Applied Discount : $" + discount); System.out.println("Total Amount after discount : $" + (amount - discount)); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.