Your parents have gotten you a flex card meal plan, where youcan choose to eat a
ID: 3613475 • Letter: Y
Question
Your parents have gotten you a flex card meal plan, where youcan choose to eat at many fine dining establishments at or nearcampus. Although you have many, many options of where to eat, youhave quickly narrowed down a simple strategy:
You will ALWAYS eat at either Subway or Lazy Moon.
You know you want to avoid the freshman fifteen, soyou’ve included Subway on your list. Of course, it helps thatSubway is relatively inexpensive.
But, like all college students, you love pizza, and Lazy Moonundoubtedly has some good pizza. Unfortunately, what you like tobuy at Lazy Moon costs more than what you like to buy atSubway.
Thus, after determining how many times you will have toeat out the whole semester, your goal is to maximize the amount oftimes you eat at Lazy Moon without going over the allotted amountof money your parents have given you to spend on your flex card.Furthermore, you’d like to know how much money, if any, willbe left on your card after the semester is over.
You will prompt the user for the following information:
1. The cost of a meal at Subway (in dollars – mustbe an integer).
2. The cost of a meal at Lazy Moon (in dollars – must bean integer and greater than #1).
3. The number of meals you will need to eat for thesemester.
4. The amount of money (in dollars – must be an integer)your parents have put on your meal card.
Input Specification
1. The cost of both meals will be positive integers less than 20with the cost of a meal at Lazy Moon being more expensive than thecost of a meal at Subway.
2. The number of meals will be a positive integer less than300.
3. The amount of money your parents place on your meal card willbe a positive integer that is somewhere in between the cost ofeating every meal at Subway and the cost of eating every meal atLazy Moon, inclusive.
Output Specification
Output the number of meals you will eat at both Subway and LazyMoon, as well as the amount of money leftover on your card at theend of the semester. Follow the format shown below:
You will eat X meals at Subway and Y meals at LazyMoon.
You will have $Z left on your card.
X, Y and Z represent the appropriate integers.
Output Sample
Here is one sample output of running the program. Note that thistest is NOT a comprehensive test. You should test your program withdifferent data than is shown here based on the specificationsgiven. The user input is given in italics while theprogram output is in bold.
Sample Run
How much do you spend on a meal at Subway?
4
How much do you spend on a meal at LazyMoon?
6
How many meals will you eat this semester?
150
How much money did your parents put on your mealcard?
749
You will eat 76 meals at Subway and 74 meals at LazyMoon.
You will have $1 left on your card.
Explanation / Answer
please rate - thanks #include #include int main(void) { int subway, LazyMoon, spendsub, spendlazy,totalmeals, totalmoney; int left=0,spent; printf ("How much do you spend on a meal atsubway? "); scanf ("%d", &spendsub); printf ("How much do you spend on a meal at LazyMoon? "); scanf ("%d", &spendlazy); printf ("How many meals will you eat thissemester? "); scanf ("%d", &totalmeals); printf ("How much money did your parents put onyour meal card? "); scanf ("%d", &totalmoney); for(subway=1;subwayRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.