calculate change

This commit is contained in:
buzz-lightsnack-2007 2024-02-27 21:33:04 +08:00
parent 5137cf68b6
commit 226feb7c46

View file

@ -4,4 +4,46 @@ package tech.iBeans.POSware.Lite;
import java.util.*;
import java.math.*;
public class payment{};
public class payment{
public static Float total = null;
public static Float change = null;
public static Float in = null;
public static void init() {
/* Set up the payment. */
change = (float) 0;
in = (float) 0;
};
public static Float calculate() {
/* Calculate the change.
*
* Returns: (float) the calculated change
*/
if (total > in) {return (null);}; // Do not calculate a smaller change.
change = in - total;
return(change);
};
public static Float calculate(float TOTAL, float IN) {
/* Calculate the change from a provided total and input.
*
* Returns: (float) the calculated change
*/
total = TOTAL;
in = IN;
return(calculate());
};
public static void log() {
/* Log the payment.
*/
// TODO add payment processing here.
};
};