/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test1exp; /** * * @author jcmt */ public class Purchase { private double totalAmount; public void Purchase() { totalAmount = 0; } public boolean setTotalAmount(double amt) { if (amt >= 0) { totalAmount = amt; return true; } else { totalAmount = 0; return false; } } public double getTotalAmount() { return totalAmount; } }