6.12 Programming Activity 2: Using for Loops
In this activity, you will write a for loop:
For this Programming Activity, you will again calculate the total cost of the items in a grocery cart. This time, however, you will write the program for the Express Lane. In this lane, the customer is allowed up to 10 items. The user will be asked for the number of items in the grocery cart. Your job is to write a for loop to calculate the total cost of the items in the cart.
Like Programming Activity 1, the framework will animate your for loop, displaying the items in the cart moving down a conveyor belt toward a cashier station (a grocery bag). It will also display the unit price of the item, the correct subtotal, and your current subtotal. By ...
Get Java Illuminated, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.