Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views4 pages

Shopping Cart Program Guide

The document describes a shopping cart program that allows users to add items to a cart, remove items from the cart, view items in the cart, and exit the program. It provides sample inputs and outputs of the program functionality.

Uploaded by

Subham kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Shopping Cart Program Guide

The document describes a shopping cart program that allows users to add items to a cart, remove items from the cart, view items in the cart, and exit the program. It provides sample inputs and outputs of the program functionality.

Uploaded by

Subham kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Shopping Cart

Lisa, the founder of “Lisa Corp,” wished to design a Products and Services System that would let
its Customers purchase Products and Services seamlessly via an online platform.
As a part of this requirement, Lisa Crop wanted to write a piece of code for his company’s
Products and services System that will enable its customers to use the menu-driven application
to add items to a cart, remove the items from the cart, view the items in the cart and exit the
application in case of no requirement.

Write a program to achieve this functionality.

Create Item class with following details


ItemCode – Integer
itemName – String
itemQty – int

Methods to be added
1. Item() – Default constructor
2. Item(int code, String name, int qty) – Three argument constructor.
3. Display method to list all items – Display(Item[] itemarr)
Note : Method to be called using class name “Item”

Input Format:
User has to make selection from the list

Output Format:
Based on selection item can be added, viewed, removed or exit from the application.
If view option is chosen on the empty cart, display message as “Cart is Empty”
If the item to be removed is not in the cart, display message as “Item not found”

Refer sample input and output for formatting specifications.

[All text in bold corresponds to input and the rest corresponds to output.]

Sample Input and Output 1:


Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
1
Enter item code:
101
Enter item name:
ball
Enter item quantity:
4
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
1
Enter item code:
102
Enter item name:
book
Enter item quantity:
3
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
3
Item code: 101
Item name: ball
Item quantity: 4
Item code: 102
Item name: book
Item quantity: 3
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
4
Thank you!!!

Sample Input and Output 2:


Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
1
Enter item code:
101
Enter item name:
ball
Enter item quantity:
4
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
1
Enter item code:
102
Enter item name:
book
Enter item quantity:
3
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
3
Item code: 101
Item name: ball
Item quantity: 4
Item code: 102
Item name: book
Item quantity: 3
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
2
Enter the code of an item:
102
Remaining items in cart..
Item code: 101
Item name: ball
Item quantity: 4
Shopping cart menu
1. Insert new item in cart
2. Remove an item from cart
3. View cart items
4. Exit
Enter your choice
4
Thank you!!!

You might also like