Java Micro-Project
Java Micro-Project
Online Shopiee
Submitted by
Patil Saloni Nivrutti
Chopadkar Tanishka Kiran
Rahane Divya Dattatray
Affiliated to
Maharashtra State
Board of Technical Education
Certificate
This is to certify that Ms. Saloni Nivrutti Patil with Roll No-5 has successfully completed Micro-project in
course Java Programming.(22412)for the academic year 2022-23 as prescribed in the 'Assessment Manual'during
her tenure of completing Fourth Semester of Diploma Programme inComputer Engineering from institute,
Sandip Polytechnic with institute code 1167.
Certificate
This is to certify that Ms. Chopadkar Tanishka Kiran with Roll No-14 has successfully completed Micro-
project in course Java Programming.(22412)for the academic year 2022-23 as prescribed in the 'Assessment
Manual'during her tenure of completing Fourth Semester of Diploma Programme in Computer Engineering from
institute, Sandip Polytechnic with institute code 1167.
Certificate
This is to certify that Ms. Rahane Divya Dattaray with Roll No-62 has successfully completed Micro-project in
course Java Programming.(22412)for the academic year 2022-23 as prescribed in the 'Assessment Manual'during
her tenure of completing Fourth Semester of Diploma Programme inComputer Engineering from institute,
Sandip Polytechnic with institute code 1167.
2 Review of Literature
6 Design of System
11 Testing of System
12 Compilation of Report
13 Compilation of Presentation
14 Presentation of Seminar
15 Final Submission
Prof.R.C Mahajan
Name & Signature of Course Teacher
Annexure – II
After the topic for our project was selected, we segregated the work load as follows
1. Researching and collecting the required information was done by our team members
Tanishka , Divya and Saloni.
2. Arrangement of this work in appropriate manner and cross checking of the same was done.
3. Compiling this work and formatting of the report was done by our team members Divya and
Saloni.
6.0 Actual Resources Used:
Sr
Name of Resource/Material Specification Qty. Remarks
No
Desktop with Intel -
Core 2 Duo 2.93
1 Hardware Resource GHz, RAM 2GB, 1
HDD 160 GB
Star UML , -
2 Software Resource 1
Rational Rose
3 Any Other Resource - - -
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class ShopDetails {
private String accno;
private String name;
private long balance;
Scanner sc = new Scanner(System.in);
String id = null;
String productName = null;
int quantity = 0;
double price = 0.0;
double totalPrice = 0.0;
double overAllPrice = 0.0;
double cgst, sgst, subtotal=0.0, discount=0.0;
char choice = '\0';
ShopDetails(){
ShopDetails(String id, String pname, int qty, double price, double totalPrice)
{
this.id=id;
this.productName = pname;
this.quantity = qty;
this.price = price;
this.totalPrice = totalPrice;
}
// display
public void display()
{
System.out.format(" %-9s %-9s %5d %9.2f
%14.2f\n" ,id, productName, quantity, price, totalPrice);
}
System.out.print("Quantity: ");
quantity = sc.nextInt();
choice = sc.next().charAt(0);
//read remaining characters, don't store (no use)
sc.nextLine();
}
while (choice == 'y' || choice == 'Y');
//display all product with its properties
ShopDetails.displayFormat();
for (ShopDetails p : product)
{
p.display();
}
//price calculation
System.out.println("\n\t\t\t\t\t\t\t\t\t\tTotal Amount (Rs.) " +overAllPrice);
//calculating discount
discount = overAllPrice*2/100;
System.out.println("\n\t\t\t\t\t\t\t\t\t\t Discount (Rs.) " +discount);
//total amount after discount
subtotal = overAllPrice-discount;
System.out.println("\n\t\t\t\t\t\t\t\t\t\t Subtotal "+subtotal);
//calculating tax
sgst=overAllPrice*12/100;
System.out.println("\n\t\t\t\t\t\t\t\t\t\t SGST (%) "+sgst);
cgst=overAllPrice*12/100;
System.out.println("\n\t\t\t\t\t\t\t\t\t\t CGST (%) "+cgst);
• Class shop contains main function. It accepts number of customers, for getting the number
of customers and customer details we use the array of object concept. For that we declare
the openAccount() function.
• In the main function ,the menu of the mart opens showing different options
for thecustomer like …1. Display Account details
2. Shop Groceries…etc., Customer should choose from the
givenoptions
• Here , user chooses choice1 i.e Display All Account Details. It displays all account
detailswhich is present in a store/data in sequential manner.
• In Choice 2 customer searches for the specific account whichever he/her want to
see. Customer get that account details by entering the account number. If the
account numberis present it displays the details of that specific account.
• If customer enters the account number which does not exists , then it will
shows themessage “Search failed! Account doesn’t exist..!! “
• If Customer wants to add balance in his/her account then, they can do that. For this customer
need to their account number and after that insert amount they want to insert. For this we use
the deposit() function.
• If customer enters the account number which does not exists , then it will shows the
message “Search failed! Account doesn’t exist..!! “
• Choice 4 i.e., “Shop Groceries “. This will help the user to shop for the products by passing
the control to shopping () function. The function contains the array list for storing the items
entered.
If inputs the id, product name, quantity and the price of that product. The reason forinputting
price is to get more justification of the product from user.
It continues to get products till user say’s NO.
Later the bill be prepared in the format specified in display format() function and display().
In the bill , it displays the total price , discount is calculated as “overall price* 2 / 100 “
• Java Package
A java package is a group of similar types of classes, interfaces and sub-packages.Package
in java can be categorized in two form, built-in package and user-defined package.There
are many built-in packages such as java, lang, awt, javax, swing, net, io, util, sql etc.Here,
we will have the detailed learning of creating and using user-defined packages.
Types of packages:
1. User defined packages
2. In built packages
3.Built-in Packages
These packages consist of a large number of classes which are a part of Java API.Some of
the commonly used built-in packages are:
1) java.lang: Contains language support classes(e.g classed which defines primitive data
types, math operations). This package is automatically imported.
2) java.io: Contains classed for supporting input / output operations.
3) java.util: Contains utility classes which implement data structures like Linked List,
Dictionary and support ; for Date / Time operations.
4) java.applet: Contains classes for creating Applets.
5) java.awt: Contain classes for implementing the components for graphical user interfaces (like
button , ;menus etc).
6) java.net: Contain classes for supporting networking operations.
• Array:
Array in java are non-primitive data type that store elements of a similar data type in the memory.
Arrays in java can store both primitive and non-primitive types of data in it.
Types of Arrays in java:
1. Single Dimensional Array
2. Multidimensional Array
• Java Scanner:
Scanner class in Java is found in the java.util package. Java provides various ways to read input
from the keyboard, the java.util.Scanner class is one of them.
The Java Scanner class breaks the input into tokens using a delimiter which is whitespace by
default. It provides many methods to read and parse various primitive values.
The Java Scanner class is widely used to parse text for strings and primitive types using a
regular expression. It is the simplest way to get input in Java. By the help of Scanner in Java,
we can get input from the user in primitive types such as int, long, double, byte, float, short,
etc.
The Java Scanner class extends Object class and implements Iterator and Closeable interfaces.
• Method :
A method is a way to perform some task. Similarly, the method in Java is a collection of
instructions that performs a specific task. It provides the reusability of code. We can also
easily modify code using methods. In this section, we will learn what is a method in Java,
types of methods, method declaration, and how to call a method in Java.
Methods that we used in our programs :
Void open Account()
Void show Account ()
Void deposit()
• Constructor:
A constructor is a block of codes similar to the method. It is called when an instance of the class
is created. At the time of calling constructor, memory for the object is allocated in the memory.
It is the special type of method to initialize the object.
Constructor we used in our program:
Default constructor
Parameterized constructor
• Java List:
List in Java provides the facility to maintain the ordered collection. It contains the index-based
methods to insert, update, delete and search the elements. It can have the duplicate elements also.
We can also store the null elements in the list.
The List interface is found in the java.util package and inherits the Collection interface. It is
a factory of ListIterator interface. Through the ListIterator, we can iterate the list in forward
and backward directions
• Do – while Loop :
The Java do-while loop is used to iterate a part of the program repeatedly, until the specified
condition is true. If the number of iteration is not fixed and you must have to execute the
loop at least once, it is recommended to use a do- while loop.
Java do-while loop is called an exit control loop. Therefore, unlike while loop and for loop,
the do-while check the condition at the end of loop body. The Java do-while loop is executed
at least once because condition is checked after loop body.
• Switch Case :
The Java switch statement executes one statement from multiple conditions. It is like if-else-if
ladder statement. The switch statement works with byte, short, int, long, enum types, String and
some wrapper types like Byte, Short, Int, and Long. Since Java 7, you can use strings in the
switch statement.
In other words, the switch statement tests the equality of a variable against multiple values.
We have used switch Case
➢ To Display all account details
➢ Search by account number
➢ Add balance to cart
9.0 Skilled Developed/Learning Outcome of this Micro-Project:
Prof.R.C Mahajan
Name & Signature of CourseTeacher
Annexure – IV
(A) (B)
Total Marks
Process and Product Assessment Individual Presentation/Viva
(10 Marks)
(6 Marks) (4 Marks)
(A) (B)
Total Marks
Process and Product Assessment Individual Presentation/Viva
(10 Marks)
(6 Marks) (4 Marks)
Dated Signature:
Annexure – IV
(A) (B)
Total Marks
Process and Product Assessment Individual Presentation/Viva
(10 Marks)
(6 Marks) (4 Marks)
Dated Signature: