I am having a lot of trouble with this. I am making a C program that takes a users input for price of a meal at Restaurant 1 and price at Restaurant 2, then it asks for how many meals you will eat during the semester, and finally how much money your parents have put on your meal card.
The input specifications are as follows. ALL input numbers are integers. Rest 2 is always more expensive that Rest 1. The amount of money put on the meal card is somewhere between the cost of eating every meal at Rest1 and every meal at Rest 2.
The output should look as follows:
You will eat X meals at rest1 and Y meals at rest2.
You will have $Z left on your card.
I was given the following sample run of the program to help:
How much do you spend on a meal at Rest 1?
How much do you spend on a meal at Rest 2?
How many meals will you eat this semester?
How much money did your parents put on your meal card?
You will eat 76 meals at Rest 1 and 74 meals at Rest 2.
You will have $1 left on your card.
I know how to implement all the coding for this program but what I can't seem to figure out is the mathematical formula to give me the desired outputs. I have tried several methods. Any tips would be appreciated. Remember, all numbers are integers.
Thanks so much!