You are on page 1of 20

Java Programming (JPR) – 22412 Group- 2

DEPARTMENT OF INFORMATION
TECHONLOGY
2022-2023

Micro Project Report


On
Java Programming [JPR]
Online Shopping Cart

Academic year: 2022-23

Program code: IF4I


Course: Java Programming
Course Code: 22412
Subject Teacher: Mr. Chintamani Chavan
Group No: 02

ZAGDU SINGH CHARITABLE TRUST (REGD.)

THAKUR POLYTECHNIC
(An ISO 9001:2008 Certified Institute)
Thakur Complex, West to W. E. Highway, Kandivali (E), Mumbai – 400 101
(Accredited by: National Board Of Accreditation)

Department Of Information Technology IF4I 1


Java Programming (JPR) – 22412 Group- 2

MAHARASHTRA STATE BOARD OF


TECHNICAL EDUCATION
Certificate
This is to certify that:

Anjali Chaurasiya (01)


Urvi Narvekar(05)
Suhani Sinha(14)
Sanskruti Londhe(54)

of 4th Semester of Diploma in Information Technology of


Institute, Thakur Polytechnic (Code:0522) have completed the
Micro Project (Online Shopping Cart) satisfactorily in Subject –
Java Programming for the academic year 2022-2023 as prescribed
in the curriculum.

Place: Mumbai Enrollmen No.: 2105220096(1)


2105220100(5)
2105220100(14)
2105220151(54)

Date: …………. Seat No.: ……………...

Seal of
Institute

Subject Teacher Head of the Department Principal

Department Of Information Technology IF4I 2


Java Programming (JPR) – 22412 Group- 2

ACKNOWLEDGEMENT
This acknowledgment transcends the reality of formality when we would
like to express deep gratitude and respect to all those people behind the
screen who guided, inspired and helped me for the completion of our
project work.

This project would add as an asset to my academic profile. We express


our sincere gratitude to our respectful Principal Dr. S.M. Ganechari for
enabling us to make use of laboratory and library facilities liberally, that
helped us a long way in carrying out our project work successfully.

We consider ourselves lucky enough to get such a good project. This


project would add as an asset to my academic profile. We express our
gratitude to the help of the Head of the Department of Information
technology, Mrs. Suwarna Thakre, for her constant supervision, guidance
and co-operation throughout the project and we would like to express our
thankfulness to our project guide (subject teacher), Mr. Chintamani
Chavan for his constant motivation and valuable help through the project
work. We extend our sincere gratitude to our parents who have
encouraged us with their blessings to do this project successfully.
THANK YOU

Department Of Information Technology IF4I 3


Java Programming (JPR) – 22412 Group- 2

PROPOSAL

Department Of Information Technology IF4I 4


Java Programming (JPR) – 22412 Group- 2

Title: Online Shopping Cart

1.0 Aims/Benefits of the Micro project


 A shopping cart is a piece of software that acts as an online store's
catalog and ordering process.
 Its deeper infrastructure allows the consumers to select merchandise,
review what they have selected, make necessary modifications or
additions, and purchase the merchandise.
 Shopping carts can be sold as independent pieces of software so
companies can integrate them into their own unique online solution or
they can be offered as a feature from a service that will create and host a
company's e-commerce website.

2.0 Course Outcomes Addressed


Develop programs using Object Oriented methodology in Java.

3.0 Proposed Methodology


In order to complete this micro-project of Java Programming the procedure
that we will follow is given below.

 Data collection.
 Coordination with necessary ethics.
 Group discussion.
 References from books and internet.
 Execution.
 Prepare report.
 Presentation
 Project submission

Department Of Information Technology IF4I 5


Java Programming (JPR) – 22412 Group- 2

4.0 Action Plan

Sr Details Of Planned Planned Finish Name Of Responsible


No. Activity Start Date Date Team Members

1 Information Anjali, Urvi


search
2 Group All team members
Discussion
3 Group All team members
Discussion
4 Taking Suhani, Sanskruti
reference
5 Executions Anjali, Sanskruti
6 Compilation of Suhani, Urvi
reports
7 Presentation and All team members
report
submission

5.0 Resources Required

Sr No. Name of Resource/ Specifications Remarks


Material
1. Internet www.geeksforgeeks.org
www.freecodecamp.org -
2. Books
Programming with Java -

Department Of Information Technology IF4I 6


Java Programming (JPR) – 22412 Group- 2

REPORT

Department Of Information Technology IF4I 7


Java Programming (JPR) – 22412 Group- 2

1.0 Rationale

 A shopping cart is a piece of software that acts as an online store's catalog


and ordering process.
 Shopping cart is the interface between a company's Web site to the user.
 Its deeper infrastructure, allowing consumers to select merchandise;
review what they have selected make necessary modifications or
additions and purchase the merchandise.
 Shopping carts can be sold as independent pieces of software so
companies can integrate them into their own unique online solution or
they can be offered as a feature from a service that will create and host a
company's e-commerce website.

2.0 Aims/Benefits of the Micro-Project


1. The “Shopping Cart” has been developed with java programming using
jdk application.
2. This also minimizes paperwork and manual tasks.
3. Shopping cart helps us in this project for shopping the things in easy way
from any place.

3.0 Course Outcomes Integrated :

Develop programs using Object Oriented methodology in Java.

4.0 Literature Review

 These applications typically provide a means of capturing a client's


payment information, but in the case of a credit card they rely on the
software module of the secure gateway provider, in conjunction with the
secure payment gateway, in order to conduct secure credit card
transactions online.
 Some setup must be done in the HTML code of the website, and the
shopping cart software must be installed on the server which hosts the
site, or on the secure server which accepts sensitive ordering
information.
 E-shopping carts are usually implemented using HTTP cookies or query
strings. In most server base implementations however, data related to the
shopping cart is kept in the session object and is accessed and
manipulated on the fly, as the user selects different items from the cart .
 Later at the process of finalizing the transaction, the information is
accessed and an order is generated against the selected item thus clearing
the shopping cart.

Department Of Information Technology IF4I 8


Java Programming (JPR) – 22412 Group- 2

 Although the most simple shopping carts strictly allow for an item to be
added to a basket to start a checkout process (e.g., the free PayPal
shopping cart), most shopping cart software provides additional features
that an Internet merchant uses to fully manage an online store. Data
(products, categories, discounts, orders, customers, etc.) is normally
stored in a database and accessed in real time by the software.
 Shopping cart software can be generally categorized into three types of
E-commerce software.

5.0 Actual Methodology followed

Once the micro project title was disclosed, the given topic was divided into
smaller subtopics which then were sent to all the group members. Once the
group members had received their subtopics, the team members researched
their sub topic and sent their respective data to the team group for everyone
to read and understand. This data was then be accumulated in a report and
submitted to Sir Chintamani Chavan for correction.

6.0 Actual Resources Used

Sr No. Name of Resource/ Specifications Remarks


Material
1. Internet www.geeksforgeeks.org
www.freecodecamp.org -
2. Books
Programming with Java -

7.0 Outputs of the Micro-Projects

import java.util.Scanner;
import java.util.Vector;
import java.io.FileWriter;
import java.io.IOException;
import java.io.File;
import java.io.FileNotFoundException;

public class ShoppingCart


{
Vector v1 = new Vector();
Vector v2= new Vector();
Vector v3 = new Vector();

Department Of Information Technology IF4I 9


Java Programming (JPR) – 22412 Group- 2

Vector v4 = new Vector();


String iname;
float icost, total;
int quantity;
int i = 0;
int pos;
public void choices()
{
int choice;
Scanner s1=new Scanner(System.in);
System.out.println(" ENTER YOUR CHOICE");
System.out.println(" 1__Add Item To Cart");
System.out.println(" 2__Remove Item From Cart");
System.out.println(" 3__Search Item");
System.out.println(" 4__Update The Cart");
System.out.println(" 5__Show The Cart");
System.out.println(" 6__Save The Cart");
System.out.println(" 7__Load The Cart To The Last Saved Point");
System.out.println(" 8__Clear Cart");
System.out.println(" 9__Checkout");
choice=s1.nextInt();
switch (choice)
{
case 1:
add();
break;
case 2:
if(i>0)
{
remove();
}
else
{
System.out.println("Aughs!!Your Cart Is Empty-----\n\n");
choices();
}
break;
case 3:
if(i>0)
{
search();
}
else

Department Of Information Technology IF4I 10


Java Programming (JPR) – 22412 Group- 2

{
System.out.println("Aughs!!Your Cart Is Empty-----\n\n");
choices();
}
break;
case 4:
if(i>0)
{
update();
}
else
{
System.out.println("Aughs!!Your Cart Is Empty-----\n\n");
choices();
}
break;
case 5:
if(i>0)
{
show();
}
else
{
System.out.println("Aughs!!Your Cart Is Empty-----\n\n");
choices();
}
break;
case 6:
if(i>0)
{
SaveCart();
}
else
{
System.out.println("Aughs!!Your Cart Is Empty-----\n\n");
choices();
}
break;
case 7:
load();
break;
case 8:
clear();

Department Of Information Technology IF4I 11


Java Programming (JPR) – 22412 Group- 2

break;
case 9:
if(i>0)
{
cartTotal();
}
else
{
System.out.println("You Bought Nothing-------\n");
}
break;
default:
System.out.println("Oops!! Incorrect Choice!! Try Again");
break;
}
}

public void add()


{
System.out.println("ADD>>>>>>");
Scanner s = new Scanner(System.in);
System.out.println("Enter the Name Of Item:");
iname=s.next();
v1.add(i,iname);
System.out.println("Enter the Price Of This Item:");
icost=s.nextInt();
v2.add(i,icost);
System.out.println("Enter the Quantity Of This Item:");
quantity=s.nextInt();
v3.add(i,quantity);
total = quantity*icost;
v4.add(i,total);
i++;
System.out.println("\nADDED SUCCESFULLY!!!\n");
choices();
}

public void remove()


{
System.out.println("REMOVE>>>>>>>\n");
for(int j=0;j<i;j++)
{
System.out.print((j+1)+"_"+v1.elementAt(j)+" ");

Department Of Information Technology IF4I 12


Java Programming (JPR) – 22412 Group- 2

}
System.out.println("\nWhat is the position of your item that you want to
remove");
Scanner s2 =new Scanner(System.in);
pos=s2.nextInt();
pos=pos-1;
System.out.println("Removed Item is:"+v1.elementAt(pos));
v1.remove(pos);
v2.remove(pos);
v3.remove(pos);
v4.remove(pos);
i--;
System.out.println("\nREMOVED SUCCESSFULLY!!!\n");
choices();
}

public void search() {


System.out.println("SEARCH>>>>>>>\n");
Scanner s = new Scanner(System.in);
System.out.println("Enter the Name Of Item:");
String itemName = s.next();
int index = v1.indexOf(itemName);
if (index == -1) {
System.out.println("\nItem not found in cart\n");
}
else
{
System.out.println("\nItem found at position: " + (index + 1) +"\n");
System.out.println("ITEM: "+v1.elementAt(index));
System.out.println("COST: "+v2.elementAt(index)+" rs");
System.out.println("QUANTITY: "+v3.elementAt(index));
System.out.println("------------------------");
System.out.println("TOTAL: "+v4.elementAt(index)+" rs");
System.out.println("------------------------\n\n\n");
}
choices();
}

public void update() {


System.out.println("UPDATE>>>>>>\n");
for (int j = 0; j < i; j++) {
System.out.println((j + 1) + "_" + v1.elementAt(j) + " ");
}

Department Of Information Technology IF4I 13


Java Programming (JPR) – 22412 Group- 2

System.out.println("\nWhat is the position of your item that you want to


update");
Scanner s3 = new Scanner(System.in);
pos = s3.nextInt();
pos = pos - 1;
System.out.println("What you want to update : Name of the item, price or
Quantity");
System.out.println("Enter : 1_For updating name of the item");
System.out.println(" 2_For updating price of the item");
System.out.println(" 3_For updating Quantity");
int c=s3.nextInt();
switch(c)
{
case 1:
System.out.println("Enter the new Name Of Item:");
iname = s3.next();
v1.set(pos, iname);
System.out.println("\nUPDATED SUCCESFULLY!!!\n");
break;

case 2:
System.out.println("Enter the new Price Of This Item:");
icost = s3.nextInt();
v2.set(pos, icost);
System.out.println("\nUPDATED SUCCESFULLY!!!\n");
break;

case 3:
System.out.println("Enter the new Quantity Of This Item:");
quantity = s3.nextInt();
v3.set(pos, quantity);
total = quantity * icost;
v4.set(pos, total);
System.out.println("\nUPDATED SUCCESFULLY!!!\n");
break;
default:
System.out.println("Oops!! Incorrect Choice!! Try Again");
break;
}
choices();
}

public void show()

Department Of Information Technology IF4I 14


Java Programming (JPR) – 22412 Group- 2

{
System.out.println("YOUR CART>>>>>\n");
for(int j = 0;j<i;j++)
{
System.out.println("ITEM: "+v1.elementAt(j));
System.out.println("COST: "+v2.elementAt(j)+" rs");
System.out.println("QUANTITY: "+v3.elementAt(j));
System.out.println("------------------------");
System.out.println("TOTAL: "+v4.elementAt(j)+" rs");
System.out.println("------------------------\n\n\n");
}
choices();
}
public void SaveCart()
{
// Save cart items to a file
try
{
FileWriter writer = new FileWriter("cart_items.txt");
for (int j = 0; j < i; j++)
{
writer.write(v1.elementAt(j) + " , " + v2.elementAt(j) + " , " +
v3.elementAt(j) + " , " + v4.elementAt(j) + "\n");
}
writer.close();
System.out.println("Cart items saved to the file 'cart_items.txt' \n\n");
}
catch (IOException e) {
System.out.println("An error occurred while saving cart items to file.");
e.printStackTrace();
}
choices();
}

public void load()


{
try
{
File file = new File("cart_items.txt");
Scanner sc = new Scanner(file);
while (sc.hasNextLine())
{
String line = sc.nextLine();

Department Of Information Technology IF4I 15


Java Programming (JPR) – 22412 Group- 2

// Split the line into separate values based on the comma delimiter
String[] values = line.split(", ");
System.out.println("Item:" + values[0] + "\tPrice:" + values[1] +
"\tQuantity:" + values[2] + "\tTotal:" + values[3]);
System.out.println();
}
sc.close();
}
catch (FileNotFoundException e)
{
System.out.println("An error occurred while reading cart items from file.");
e.printStackTrace();
}
choices();
}
public void clear()
{
v1.clear();
v2.clear();
v3.clear();
v4.clear();
i = 0; // reset the item count to zero
System.out.println("Cart cleared successfully!\n\n");
choices();
}

void cartTotal()
{
float cartt=0;
for(int j = 0;j<i;j++)
{
cartt=(float)v4.elementAt(j)+cartt;
}
System.out.println("||*****************************||");
System.out.println(" You Have Done Shopping Of: "+cartt+" rs ");
System.out.println(" Pay The Total through UPI");
System.out.println(" Visit us Again ^_^");
//System.out.println("||*****************************||");
}
public static void main(String[] args)
{
System.out.println("\n\n||****************************||");
System.out.println("|| ||");

Department Of Information Technology IF4I 16


Java Programming (JPR) – 22412 Group- 2

System.out.println("|| Welcome to Ecomart ||");


System.out.println("|| ||");
System.out.println("||****************************||\n");
System.out.println(" Let's Roll!>>>>>\n");
ShoppingCart obj = new ShoppingCart();
obj.choices();
}
}

OUTPUT-

Department Of Information Technology IF4I 17


Java Programming (JPR) – 22412 Group- 2

Department Of Information Technology IF4I 18


Java Programming (JPR) – 22412 Group- 2

Department Of Information Technology IF4I 19


Java Programming (JPR) – 22412 Group- 2

8.0 Skill developed/ Learning out of this Micro-Project:-

- We have learn about java programming.


- It manages all the information about total available, adding, removing the cart.
- The purpose of the project is to build an application program to reduce the
manual.

9.0 Conclusion:-

1. This project has real time applications this project is used to manage all
the information about online shopping cart.
2. This project is especially useful for people for getting all required things
for their.

 Name of Team Members with Roll No.

Anjali Chaurasiya (01)


Urvi Narvekar (05)
Suhani Sinha (14)
Sanskruti Londhe (54)

MR. CHINTAMANI CHAVAN


(SUBJECT TEACHER)

Department Of Information Technology IF4I 20

You might also like