Actually these is not just printing text. It somehow involves logic but I keep on thinking these for almost a week. First I printed a price list then I want also to print the receipt. What can I put to eliminate the price list and then print the receipt. But before showing the receipt the price list must be shown first.

Recommended Answers

All 2 Replies

You'll have to give some more details and some code to chew on.

If you want to print a price list and then print a receipt, one good way to do it would be to look at the similarities: both a receipt and a price list contain items. So you could build an item class that had variables such as cost and sales tax along with it, then you could have a method for printing an item's price and a method for printing the item onto a receipt. You could create an array of these items, then loop through, printing the price of each to form a price list.

If you wanted to erase the price list, you could have an array or arraylist of items, and delete each one as you went, perhaps adding them to a second list of items that would aid you in printing a receipt.

If this isn't helpful then elaborate on your question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.