calculate change
This commit is contained in:
parent
5137cf68b6
commit
226feb7c46
1 changed files with 43 additions and 1 deletions
|
@ -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.
|
||||
};
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue