Tuesday, September 28, 2010

Lab Test 1- Section 6 - Shopping card

Write a java program which will simulate a "shopping card". Here is a sample interaction of the program:
>Welcome! Enjoy shopping! We sell a Shirt at $15, a pair of Shoes at $30 and a Hat at $5.
>What do you want to buy (enter "done" to quit)?
>shirt
>You are carrying 1 Shirt.
>What do you want to buy (enter "done" to quit)?
>Shoe
>You are carrying 1 shirt and 1 pair of shoes.
>What do you want to buy (enter "done" to quit)?
>Shirt
>You are carrying 2 shirt and 1 pair of shoes.
>What do you want to buy (enter "done" to quit)?
>Hat
>You are carrying 2 shirt, 1 pair of shoes, 1 Hat.
>done
>Your total bill is $65
>Goodbye
Your program should take the following inputs:
  1. If you want to buy a shirt, give input as: Shirt
  2. If you want to buy a pair of shoes, give input as: shoe
  3. If you want to buy a hat, give input as: hat
  4. If you want to quit the program: done
When you are done, submit your program in the dropbox.

No comments: