Homework question

An app is being developed for a grocery store's loyalty program. At the end of each month, the app calculates the number of reward points to award a user, based on the following factors: If the user purchased less than $100 worth of groceries, they are awarded 1 reward point per dollar spent. If the user purchased at least $100 worth of groceries, but less than $500, they are awarded 2 reward points per dollar spent. If the user purchases $500 or more worth of groceries, they are awarded 1000 reward points in a lump sum, plus an additional 2 points for every dollar spent over $500. For every month that the member has been in the loyalty program, they also receive an additional 20 points. Member also have the choice to "cash out" 25% of their points each month if they wish, which is deducted from their monthly total of points. The following code sequence shows the Click event for one of the app’s buttons: Write the code sequence for the procedure calcLoyaltyPoints so that it will display the correct total cost in the lblQuote label.

![image|690x201](upload://17M925v


ZQhCsbbNV8OE7nbHSYAj.png)

Something went wrong when uploading your images. What have you tried yourself to make the code?

hy, yes i have tried but no luck.

I'm a beginner in MIT app inventor and i am trying to solve this question. if any one could help me
that would be great

Show what you have tried please. We like it when users show what they have tried. Else it would seem you only want a solution.

This smells like an assignment. Is this your homework?

2 Likes

yes its a part of a assignment. Can anyone please help me?
I am trying my best to come up with a solution but i am getting nowhere.
please help me.

Like I said, show what you have tried.

You need a good data foundation to build on.

You need two persistent tables:

  1. Customer enrollment, unchanging after enrollment:
  • Customer name (ABG)
  • Customer start date (10/30/2021)
  1. Customer activity, adding one row per customer per month:
  • Customer name (ABG)
  • Year-Month (202210)
  • Total purchases this month ($)
  • Starting reward points carried over from previous month
  • reward points awarded this month
  • reward points cashed out this month
  • end of month reward points remaining

With these stepping stones, you can cross the data river without drowning in data.

hi can i ask for the code of these?