Question: Must be in java programming language. Program 2: John goes to a bakery to buy cookies and tries to calculate the shortfall if the current
Must be in java programming language.

Program 2: John goes to a bakery to buy cookies and tries to calculate the shortfall if the current money is not enough. The price of one cookie is K, the number of cookies to buy is N, and the current amount of money is M. If he calculates the shortfall (S), his mother will pay the money (shortfall). For example, the price of one cookie is $3, the number of cookies bought is 4, When he has $10, the money he needs is $2. If the price of one cookie is $2.50, the number of cookies to buy is 2. and he has $1.50, the money that his mother has to pay is $3.50. If the price of one cookie is $0.20, the number of sweets to buy is 6, and he has $1.50, the money he needs from his mother is $0. Input & Output Format T = the number of test case K = the price of one cookie N = the number of cookie M = the amount of money John has S = the amount of money he will ask his mother to pay (K, N, and M are non-negative) Input KNM Output Example Input 3 30.00 4 100.00 2.50 2 1.40 2.00 6 12.00 Output 20.00 3.60 0.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
