attempt fixing the decimal places
This commit is contained in:
		
							parent
							
								
									b21f48c4ff
								
							
						
					
					
						commit
						1d8a2816ae
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -34,6 +34,8 @@ public class transact { | |||
|     } | ||||
|     */ | ||||
| 
 | ||||
|     private final static DecimalFormat FORMAT_DECIMAL = new DecimalFormat("#.00"); | ||||
|      | ||||
|      | ||||
|     public static void init() { | ||||
|         /* Initialize the variables, setting them with default values.  | ||||
|  | @ -120,7 +122,6 @@ public class transact { | |||
|         if (item_details != null) { | ||||
|             if (item_details.get("Price") != null) { | ||||
|                 // Set up the decimal format.  | ||||
|                 DecimalFormat FORMAT_DECIMAL = new DecimalFormat("#.00"); | ||||
| 
 | ||||
|                 item_pricing.put("unit", Float.valueOf(FORMAT_DECIMAL.format(Float.valueOf(item_details.get("Price").toString())))); | ||||
|                 item_pricing.put("subtotal", Float.valueOf(FORMAT_DECIMAL.format(Float.parseFloat(item_details.get("Price").toString()) * QUANTITY))); | ||||
|  | @ -251,7 +252,7 @@ public class transact { | |||
| 
 | ||||
|     public static void pay() { | ||||
|         /* Initialize the payment process of the transaction.  */ | ||||
|         payment.init(); | ||||
|         payment.init(Float.valueOf(FORMAT_DECIMAL.format(Float.valueOf(price.get("total").toString())))); | ||||
|     }; | ||||
| 
 | ||||
|     public static void finalise() { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue