I'm here trying to make a scenario, where I visit a juice shop to ask the juice seller to provide juice until a certain date, by providing him a certain amount he will provide me juice service until by balance will over.
$rate = 30; //rate of per juice glass
$total_amt = 200; //amt that provide to the seller at start of the service
$start_date = "19-08-2022"; //date of starting the service
$cost = $rate * 7; //rate * days
if($cost <= $total_amt){
echo "Remainder:".$total_amt - $cost; //Money that seller give back to buyer
} else {
echo "you need to pay extra:".$cost - $total_amt; //money need to pay exta for glass
}
I'm unable to figure out, how can I calculate the number of glass that comes inside $200 based upon the service start date and the next due date.
Example:
In $200 amount, the buyer will get 6 glass with returing balance $20, because If the buyer service start date is 19-08-2022 then the due date is 25-08-2022 (19 + 6 = 25)
So, the output needs to be like:
Number of glass in $200 is: 6
returning balance : $20
next due date: 25-08-2022