Computer Programming 2
Computer Programming 2
MARKET!
- 24BCS012 Avadhi Talera
- 24BCS071 Sanjini Shukla
Semester - 2
1CS504CC22 Computer Programming 2
Bachelor of Sciences CSE (2+2)
Table of Content
Introduction
Objectives
Algorithm
Flowchart
Implementation
Results
Introduction
An effective and user-friendly grocery shopping cart enhances the shopping
experience for customers and benefits retailers by promoting convenience,
efficiency, and satisfaction.
For Customers its about:
- Convenience
- Accessibility
- Efficiency
For Retailers it’s about:
- Customer satisfaction
- Adaptability
- Promotes eco-friendly usage
The downtown market interface helps in going back to the page and easily
adding the items as well as the quantity.
This interface also adds the GST to the total bill. Also adds a copy of the bill to
bill.txt file
Objectives
Making it User Friendly
The objective of this is to make grocery shopping easy and in the most
efficient way
Algorithm
1. Program Entry: main()
- Prints a welcome message.
- Calls showCategories() to start the menu-driven item selection
process.
2. Function: showCategories()
- A while (1) loop repeatedly displays a menu:
1] Fruits and Vegetables
2] Snacks
3] Wellness
4] Show Bill
5] Exit
- Based on the user’s input (choice), different functions are called:
- Choice Action
- 1 Calls purchaseItem() for Orange, Apple, Potato
- 2 Calls purchaseItem() for Chips, Noodles, Fries
- 3 Calls purchaseItem() for Vicks, Bandaid, Dettol
- 4 Calls showBill() to print and save bill
- 5 Exits the loop with a thank-you message
- OtherPrints "Invalid choice!" and loops again
A linked list node storing an item’s name, price, quantity, and pointer to the
next item.
Global Variables:
CartItem* cart = NULL; → head of the linked list (cart)
int totalCost = 0; → total cart value before GST
Flowchart
Code input
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
printf("\nItem\tName\tPrice\tQuantity\tTotal\n");
fprintf(file, "Item\tName\tPrice\tQuantity\tTotal\n");
Code output