0% found this document useful (0 votes)
45 views

Java Notes

Notes

Uploaded by

keshavsen1518
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Java Notes

Notes

Uploaded by

keshavsen1518
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

PRACTICALTRAINING REPORT

On

Pizza Bill Generator App

At

“Internship Studio”

Training report submitted in partial fulfillment of the requirement for award of degree

of

BACHELOROFTECHNOLOGY
of

in Computer Science and Information Technology


of

Gurugram University, Gurugram


Under the Guidance of Submitted By:
Dr. Shipra Arora Keshav
HOD 25381
june , 2024

Dronacharya Collegeof Engineering, Gurugram


STUDENT DECLARATION

I, Keshav, 25381, certify that the work contained in this industrial training report is original and
has been carried by me in the Internship Studio. This work has not been submitted to any other
institute for the award of any degree and I have followed the ethical practices and other guidelines
provided by the Department of Computer Science and Information Technology in preparing the
practical training report.

Signature
Keshav
25381
Department of Computer Science and Information Technology
Dronacharya College of Engineering, Gurugram

Certified that the above statement made by the student is correct to the best of our knowledge
and belief.

Signatures

Examined by:

1. Mentor 2. HOD

I
II
III
ACKNOWLEDGEMENT

I would like to express my sincere gratitude to Internship Studio for providing me with theinvaluable
opportunity to intern at their esteemed organization. My heartfelt thanks to Mr.Karan, whose
guidance, support, and encouragement were instrumental in making this training a truly enriching
experience. I also extend my appreciation to my colleagues and the entire team for their cooperation
and for creating a conducive learning environment. This experience has significantly enhanced my
knowledge and skills, and I am deeply grateful for the mentorship and insights gained during my
Practical

I would also like to express my sincere gratitude to my Head of Department Prof. (Dr.) Shipra Arora
for constant support and motivation. It would never be possible for us to take this training to this
level without her innovative ideas and her relent less support and encouragement.

I would like to acknowledge the support and encouragement provided by my mentor Prof. (Dr.)
Shipra Arora of the Computer Science and Information Technology Department at Dronacharya
College of Engineering. Gurugram. Her advice and continuous support were crucial in guiding me
through the training process and ensuring the successful completion of this report.

Thank you all for your support and contributions.

KESHAV
25381

IV
ABOUT COMPANY

INTRODUCTION
COMPANY NAME :

INTERNSHIP STUDIOFOUNDED

IN : 2020

HEADQUATERS: PUNE,MAHARASHTRA,INDIA

OVERVIEW:
Internship studio is an online training and internship platform founded on the principle that the
student interested in any field should not be required to have any sort of perspective knowledge in
order to starttheir journey.

The sheer lack of courses and internships out there that don’t just train students or offer them an
internship but actually do what us to come with our flagship and insdustry leading “Kickstarter
internship and istudio plus “ program in multiple domain internships.

Internship studio offers student a specialization program in digital marketing and robotics from
istudio plus and placement guarantee. With intership studio , they also provide internships in 11+
domains likeartificial intelligence , machine learning and more.

V
SERIAL NO

DECLARATION

VI
CHAPTER 1

INTRODUCTION
1.1 Java is one of the programming language or technology used for developing web applications. Java
language developed at SUN Micro Systems in the year 1995 under the guidance of James Gosling and
there team. Originally SUN Micro Systems is one of the Academic university (Standford University
Network) Whatever the software developed in the year 1990, SUN Micro Systems has released on the
name of oak, which is original name of java (scientifically oak is one of the tree name).

The OAK has taken 18 months to develop.The oak is unable to fulfill all requirements of the industry. So
James Gosling again reviews this oak and released with the name of java in the year 1995. Scientifically
java is one of the coffee seed name. Java divided into three categories, they are

 J2SE (Java 2 Standard Edition)

 J2EE (Java 2 Enterprise Edition)

 J2ME (Java 2 Micro or Mobile Edition)

J2SE J2SE is used for developing client side

applications.J2EE J2EE is used for developing server side

applications.

J2ME J2ME is used for developing mobile or wireless application by making use of a predefined protocol
called WAP (wireless Access / Application protocol).

ORGANISATION HP the largest IT company in the world, through its partner offers high quality Courses
for 4 & 6 weeks. Few Courses in Summer Training Program are Programming Techniques using 'C', PHP,
VLSI, VHDL & PCB Design, Data Structure using C Language, Core Java, J2EE - Hibernate with Spring
Framework, J2EE - Struts with Hibernate Framework, Android, ASP.NET With C#, Embedded &
Robotics-Basics & Advanced, ARM, Linux Administration with Scripting, Networking concepts with
security.
BASICS OF JAVA Overview Of Java Java is a platform independent, more powerful, secure,
highperformance, multithreaded programming language.

1.2 Here we discuss some points related to java. Define JRE The Java Runtime Environment (JRE) is part
of the Java Development Kit (JDK). It contains set of libraries and tools for developing java application.
The Java Runtime Environment provides the minimum requirements for executing a Java application.

Define JVM

JVM is set of programs developed by sun Micro System and supplied as a part of jdk for reading line by
line of byte code and it converts into native understanding form of operating system. Java language is one
of the compiled and interpreted programming language. Garbage Collector Garbage Collector is thesystem
Java program which runs in the background along with regular Java program to collect un- Referenced
(unused) memory space for improving the performance of our applications.

1
Define an API

An API (Application Programming Interface) is a collection of packages, a package is the collection of


classes, interfaces and sub-packages. A sub-package is a collection of classes interfaces and sub sub
packages etc. Java programming is containing user friendly syntax so that we can develop effective
application s. in other words if any language is providing user friendly syntax, we can develop error free
applications.

Definition of JIT

JIT is the set of programs developed by SUN Micro System and added as a part of JVM, to speed up the
interpretation phase Features Of JAVA Features of a language are nothing but the set of services or
facilities provided by the language vendors to the industry programmers. Some important features are;

Java Classpath Setting Path Variable Path variable is set for providing path for all java tools like java,
javac, javap, javah, jar, appletviewer which are use in java programming.

These all tools are available in bin folders so we set path upto bin folders. Classpath Variable Classpath
variable is set for providing path for predefined java classes which is used in our application. All classes
are available in lib/rt.jar so we set classpath upto lib/rt.jar.

Steps For Compiling And Executing Programs The following sequence of steps represented in the
diagram use compiling the java program and executing the java programs. Difference Between JDK,JRE
AND JVM

Jvm, Jre, Jdk these all the backbone of java language. Each components have separate works. Jdk and
Jre physically exists but Jvm are abstract machine it means it not physically exists.

JVM :

JVM (Java Virtual Machine) is a software. It is a specification that provides runtime environment in
which java bytecode can be executed. It not physically exists.JVMs are not same for all hardware and
software, for example for window os JVM is different and for Linux VJM is different. JVM, JRE and
JDKare platform dependent because configuration of each OS differs. But, Java is platform independent.

JRE :

The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK). It contains set of
libraries and tools for developing java application. The Java Runtime Environment provides the
minimum requirements for executing a Java application. It physically exists. It contains set of libraries
+ other files that JVM uses at runtime.

JDK :

2
The Java Development Kit (JDK) is primary components. It physically exists. It is collection of
programming tools and JRE, JVM. Object And Class Object is the physical as well as logical entity where
as class is the only logical entity.

1.3 Class:

Class is a blue print which is containing only list of variables and method and no memory is allocated for
them. A class is a group of objects that has common properties. A class in java contains:

 Data Member

 Method

 Constructor

 Block

 Class and Interface Object:

Object is a instance of class, object has state and behaviors.An Object in java has three characteristics:

 State

 Behavior

 Identity State: Represents data (value) of an object. Behavior: Represents the behavior (functionality)of
an object such as deposit, withdraw etc.

Identity: Object identity is typically implemented via a unique ID. The value of the ID is not visible to the
external user. But,it is used internally by the JVM to identify each object uniquely.

Class is also can be used to achieve user defined data types.

1.4 Data Types

Datatype is a spacial keyword used to allocate sufficient memory space for the data, in other words Data
type is used for representing the data in main memory (RAM) of the computer. In general every
programming language is containing three categories of data types. They are

 Fundamental or primitive data types

 Derived data types

 User defined data types. Data Type Default Value Default size boolean false 1 bit char '\u0000' 2 byte
byte 0 1 byte short 0 2 byte int 0 4 byte long 0L 8 byte float 0.0f 4 byte double 0.0d 8 byte Variable
Variable is an identifier which holds data or another one variable is an identifier whose value can be
changed at the execution time of program. Variable is an identifier which can be used to identify input
data in a program.

3
1.5 Operators And Its Types

Operator is a special symbol that tells the compiler to perform specific mathematical or logicalOperation.
Java supports following lists of operators.

 Arithmetic Operators

 Relational Operators

 Logical Operators

 Bitwise Operator

 Assignment Operators

 Ternary or Conditional Operators

PROGRAMMING CONCEPTS Structure Of Java Program Structure of a java program is the standard
format released by Language developer to the Industry programmer. Sun Micro System has prescribed
the following structure for the java programmers for developing java application.

 A package is a collection of classes, interfaces and sub-packages. A sub package contains collection of
classes, interfaces and sub-sub packages etc. java.lang.*; package is imported by default and this packageis
known as default package.

 Class is keyword used for developing user defined data type and every java program must start with a
concept of class. Main( ) Method main() method is starting execution block of a java program or any java
program start their execution from main method. If any class contain main() method known as main class.
Decision Making Statement Decision making statement statements is also called selection statement. Thatis
depending on the condition block need to be executed or not which is decided by condition. If the condition
is "true" statement block will be executed, if condition is "false" then statement block will not be executed.

In java there are three types of decision making statement.

 if

 if-else

 switch Looping Statement for loop While loop do-while Wrapper Classes For each and every
fundamental data type there exist a pre-defined class, Such predefined class is known as wrapper class.
The purpose of wrapper class is to convert numeric string data into numerical or fundamental data.

1.6 Access modifiers

: Access modifiers are those which are applied before data members or methods of a class. These are usedto
where to access and where not to access the data members or methods. In java programming

4
we have four access modifiers they are JAVA USEFUL KEYWORDS Final keyword In java language
finalkeyword can be used in following way.

 Final at variable leve


l Final at method level

 Final at class level Static keyword The static keyword is used in java mainly for memory management.
Static keyword are used with variables, methods, blocks and nested class. Static is a keyword that are used
for share the same variable or method of a given class. This is used for a constant variable or a method that
is the same for every instance of a class. The main method of a class is generally labeled static. In java
language static keyword can be used for following 1. variable (also known as class variable)
2. method (also known as class method) 3. block 4. nested class This keyword this is a reference variable
that refers to the current object. It is a keyword in java language represents current class object "this"
keyword can be use in two ways.

 this . (this dot)

 this() (this off) Super keyword Super keyword in java is a reference variable that is used to refer parent
class object. Super is an implicit keyword create by JVM and supply each and every java program for
performing important role in three places.

 At variable level

 At method level

 At constructor level Synchronized Keyword Synchronized Keyword is used for when we want to allow
only one thread at a time then use Synchronized modifier. If a method or block declared as a Synchronized
then at a time only one thread is allowed to operate on the given object. JAVA CLASSES, BLOCKS AND
CONSTRUCTORS Abstract Classes

We know that every java program must start with a concept of class that is without classes conceptthere
is no java program perfect.In java programming we have two types of classes they are

1. Concrete class

2. Abstract class

1.7 Constructor And Its Types:

A constructor is a special member method which will be called implicitly (automatically) by the JVM
whenever an object is created for placing user or programmer defined values in place of default values.In
a single word constructor is a special member method which will be called automatically whenever object
is created. The purpose of constructor is to initialize an object called object initialization.
Constructors are mainly create for initializing the object. Initialization is a process of assigning userdefined
values at the time of allocation of memory space.

5
Types of constructors Based on creating objects in Java constructor are classified in two types. They are

 Default or no argument Constructor

 Parameterized constructor.

Static Block in Java Static block is a set of statements, which will be executed by the JVM before execution
of main method. At the time of class loading if we want to perform any activity we have to define that
activity inside static block because static block execute at the time of class loading. In a classwe can take
any number of static block but all these static block will be execute from top to bottom.
Relationship in Java Type of relationship always makes to understand how to reuse the feature from one
class to another class.

In java programming we have two types of relationship they are.

 Is-A Relationship

 Has-A Relationship JAVA OBJECT ORIENTED Inheritance The process of obtaining the data
membersand methods from one class to another class is known as inheritance.

It is one of the fundamental features of object-oriented programming. A class that is declared with
abstract keyword, is known as abstract class. An abstract class is one which is containing some defined
method and some undefined method. In java programming undefined methods are known as un-
Implemented or abstract method.

1.8 The process of obtaining the data members and methods from one class to another class is known as
inheritance. It is one of the fundamental features of object-oriented programming.

Types of Inheritance

 Single inheritance

 Multiple inheritance

 Hierarchical inheritance

 Multilevel inheritance

 Hybrid inheritance
Why use Inheritance ?

 For Method Overriding (used for Runtime Polymorphism).

 It's main uses are to enable polymorphism and to be able to reuse code for different classes by
putting it in a common super class

6
 For code Re-usability Method Overloading Whenever same method name is exiting multiple times in
the same class with different number of parameter or different order of parameters or different types of
parameters is known as method overloading.

Why method Overloading ?

Suppose we have to perform addition of given number but there can be any number of arguments, if we
write method such as a(int, int)for two arguments, b(int, int, int) for three arguments then it is verydifficult
for you and other programmer to understand purpose or behaviors of method they can not identify purpose
of method. So we use method overloading to easily figure out the program. For exampleabove two methods
we can write sum(int, int) and sum(int, int, int) using method overloadingconcept. Different ways to
overload the method

There are two ways to overload the method in java

 By changing number of arguments or parameters

 By changing the data type

 By changing the order of arguments.

Method Overriding Whenever same method name is existing in both base class and derived class with
same types of parameters or same order of parameters is known as method Overriding. Advantage of
JavaMethod Overriding

 Method Overriding is used to provide specific implementation of a method that is already provided by
its super class.

 Method Overriding is used for Runtime Polymorphism Interface Interface is similar to class which is
collection of public static final variables (constants) and abstract methods.The interface is a mechanismto
achieve fully abstraction in java. There can be only abstract methods in the interface. It is used to achieve
fully abstraction and multiple inheritance in Java.

Why we use Interface ?

 It is used to achieve fully abstraction.

 By using Interface, you can achieve multiple inheritance in java. When we use abstract and when
Interface If we do not know about any things about implementation just we have requirement
specification then we should be go for Interface If we are talking about implementation but not
completely (partially implemented) then we should be go for abstract Abstraction.

Abstraction is the concept of exposing only the required essential characteristics and behavior with
respect to a context. Hiding of data is known as data abstraction. In object oriented programming
language this is implemented automatically while writing the code in the form of class and object.

7
Real life example of Abstraction Abstraction shows only important things to the user and hides the internal
details for example when we ride a bike, we only know about how to ride bike but can not knowabout how
it work ? and also we do not know internal functionality of bike.

Encapsulation

Encapsulation is a process of wrapping of data and methods in a single unit is called encapsulation.
Encapsulation is achieved in java language by class concept.Combining of state and behavior in a single
container is known as encapsulation.

In java language encapsulation can be achieve using class keyword, state represents declaration of
variables on attributes and behavior represents operations in terms of method. Benefits of encapsulation

 Provides abstraction between an object and its clients.

 Protects an object from unwanted access by clients.

 Example: A bank application forbids (restrict) a client to change an Account's balance Polymorphism
The process of representing one form in multiple forms is known as Polymorphism.Here original form or
original method always resides in base class and multiple forms represents overridden method which
resides in derived classes. Polymorphism is not a programming concept but it is one of the principal of
OOPs. For many objects oriented programming language polymorphism principle is common but whose
implementations are varying from one objects oriented programming language to another object oriented
programming language.

Polymorphism principal is divided into two sub principal they are:

 Static or Compile time polymorphism

 Dynamic or Runtime polymorphism JAVA ADVANCED Package A package is a collection of similar


typesof classes, interfaces and sub-packages.

Purpose of package:

The purpose of package concept is to provide common classes and interfaces for any program separately.In
other words if we want to develop any class or interface which is common for most of thejava programsthan
such common classes and interfaces must be place in a package.

Exception Handling:

The process of converting system error messages into user friendly error message is known as Exception
handling. This is one of the powerful feature of Java to handle run time error and maintain normal flow
of java application. An Exception is an event, which occurs during the execution of a program, that
disrupts the normal flow of the program's Instructions.

8
Type of Exception:

 Checked Exception

 Un-Checked

Exception Hierarchy of

Exception classes

Multithreading:

Multithreading in java is a process of executing multiple threads simultaneously. The aim of


multithreading is to achieve the concurrent execution.

Thread:

Thread is a lightweight components and it is a flow of control. In other words a flow of control is known
as thread.

State of a thread are classified into five types they are

1. New State

2. Ready State

3. Running State

4. Waiting State

5. Halted or dead State


String:

String is a sequence of characters enclosed within double quotes (" ") is known as String. Example: "Java
Programming". In java programming to store the character data we have a fundamental datatype called
char.

Similarly to store the string data and to perform various operation on String data, we have three predefined
classes they are:

 String

 StringBuffer

 StringBuilde
rCollection:

Collections in java is a framework that provides an architecture to store and manipulate the group of
objects.All the operations that you perform on a data such as searching, sorting, insertion, manipulation,

9
deletion etc. can be performed by Java Collections.Java Collection simply means a single unit of objects.
Java Collection framework provides many interfaces (Set, List, Queue, Deque etc.) and classes (ArrayList,
Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet etc).

10
CHAPTER 2

TOOLS AND TECHNOLOGY USED

2.1 Project Title: Create Pizza Bill Generator App using Core
JavaDescription:

Project Overview: The project was developed for Pizzamania, a new pizza outlet aiming to automate its
billing process. The app was designed to handle four types of pizza: Veg Pizza, Non-Veg Pizza, Deluxe
VegPizza (with extra cheese and toppings), and Deluxe Non-Veg Pizza (with extra cheese and
toppings).

Functionality: The app is menu-driven, asking the user to select the type of pizza, additional options
like extra cheese and toppings (for regular pizzas), and whether to opt for takeaway packaging. For
Deluxe pizzas, it skips extra options since they are pre-loaded. The app then generates a bill.
2.1.1
2.1.2 Pizza Selection: The app prompts users to select the type of pizza they want (Veg, Non-Veg,
DeluxeVeg, Deluxe Non-Veg).

2.1.3 Customization Options: For Veg and Non-Veg pizzas, the app asks if the user wants to add extra
cheese or toppings. For Deluxe pizzas, these options are automatically included.

2.1.4 Takeaway Option: The app prompts the user to choose whether they want takeaway packaging,
adding packaging charges if selected.

2.1.5 Bill Generation: After all selections are made, the app calculates and displays the final bill,
including any extra charges for cheese, toppings, and takeaway packaging.

Fig 2.1: Menu-Driven Interface – Screenshot showing the menu where the user selects the type of pizza.

Fig 2.2: Customization Options Screen – Screenshot displaying the options for adding extra cheese
and toppings for regular pizzas.

Fig 2.3: Final Bill Screen – Screenshot showing the final generated bill, including itemized charges for
pizza, extras, and packaging.

11
2.2 CORE JAVA

Language: Core Java was used for developing the app, employing object-oriented principles such as
classes and objects, inheritance, and polymorphism to handle different pizza types.

Features Implemented:

Menu-driven navigation using loops and switch-case statements.Input

handling using the Scanner class.

Conditional logic to differentiate between regular and Deluxe pizzas.


2.1.6
2.1.7 Object-Oriented Design: Implementation of classes for different pizza types (e.g., VegPizza,
NonVegPizza, DeluxeVegPizza, DeluxeNonVegPizza), showcasing inheritance and method
overriding.

2.1.8 Input Handling: Efficient use of the Scanner class to capture user selections and validate inputs.

2.1.9 Conditional Logic: Use of if-else and switch-case constructs to handle different scenarios,
likeadding extra cheese or skipping options for Deluxe pizzas.

Fig 2.4: Class Diagram – Diagram illustrating the object-oriented structure of the app, showing
relationships between different pizza classes.

Fig 2.5: Code Snippet for Menu Navigation – Code snippet demonstrating the switch-case logic used
for menu-driven navigation.

Fig 2.6: Bill Calculation Logic – Code snippet showing how the bill is calculated based on user inputs.

2.2 Integrated Development Environment (IDE) –


Eclipse/IntelliJDescription:

12
IDE Used: The app was developed in an IDE like Eclipse or IntelliJ, which provided a robust
environment for writing, testing, and debugging Java code.

Features Utilized:

Syntax highlighting, code completion, and error checking to streamline development.Integrated

debugger to step through code and troubleshoot issues.

2.2.1
2.2.2 Code Development: Writing and organizing Java classes and methods within the IDE.

2.2.3 Debugging and Testing: Using the IDE’s debugging tools to identify and resolve bugs, ensuring the
app behaves as expected under various scenarios.

Fig 2.7: Eclipse IDE Interface – Screenshot showing the Eclipse IDE with the project structure and code
editor.

Fig 2.8: Debugging Session – Screenshot showing the IDE’s debugging tools in action, with breakpoints
set and variables being inspected.

This structure covers the essential details of your project, the technologies used, and the key learning
points, with appropriate figures to illustrate the process.

13
CHAPTER 3

SNAPSHOTS OF THE WORK DONE

3.1 Introduction

In the current era of fast-paced living and technological advancement, efficiency and automation have
become crucial aspects of every business. Pizzamania, a new and promising pizza outlet, recognizes the
need to keep up with these trends to provide a seamless experience for its customers. As the outlet gears
up to make a mark in the highly competitive food industry, the management has identified the necessity
of automating their billing process to improve accuracy, speed, and customer satisfaction.

This project, titled "Create Pizza Bill Generator App using Core Java," is aimed at addressing this need by
developing a menu-driven application that automates the pizza billing process. The application is designed
to handle the billing requirements for four types of pizzas offered by Pizzamania: Veg Pizza, Non-Veg
Pizza, Delux Veg Pizza, and Delux Non-Veg Pizza. Each of these pizza variants caters to differentcustomer
preferences, with the Delux variants being pre-loaded with extra cheese and toppings.

The primary objective of this project is to create a user-friendly application that allows the user (cashier or
customer) to easily select the type of pizza, customize it with additional toppings and cheese (for non-Delux
variants), and decide whether to opt for take-away packaging. The application then generates an accurate
bill based on these selections. By automating this process, Pizzamania can ensure that the billingis not only
quick but also free from human errors, thereby enhancing the overall customer experience.
3.2
3.3 Requirements

To successfully develop the Pizza Bill Generator App, it is essential to outline the specific requirements
that the application must fulfill. These requirements can be divided into functional and non-functional
categories.

3.3.1 Functional Requirements


Pizza Selection:

14
The application must present the user with a menu to select from four types of pizzas: Veg Pizza, Non-Veg
Pizza, Delux Veg Pizza, and Delux Non-Veg Pizza.

Customization Options:

For Veg Pizza and Non-Veg Pizza, the application should allow users to add extra cheese and extra
toppings as optional features.

The Delux Veg Pizza and Delux Non-Veg Pizza should automatically include extra cheese and extra
toppings, without prompting the user for these options.

Take-Away Packaging:

After selecting and customizing the pizza, the application should ask whether the user wants to opt for
take-away packaging. If selected, an additional charge should be added to the bill.

Bill Generation:

The application should calculate the total cost based on the selected pizza type, customizations, and
packaging options, and generate a detailed bill displaying the breakdown of costs.

User Interface:

The application should feature a simple, menu-driven interface that guides the user through the pizza
selection and billing process step by step.

3.3.2 Non-Functional Requirements


Performance:

The application should be optimized for quick execution, ensuring that the billing process is completed
within a few seconds.

Usability:

The user interface should be intuitive and easy to navigate, with clear instructions provided at each step.

15
Maintainability:

The code should be well-documented and modular, allowing for easy updates and enhancements in the
future.

The application should be thoroughly tested to ensure that it produces accurate bills under all
scenarios,withno crashes or unexpected behavior.

Fig 3.1: Use Case Diagram Illustrating the Functional Requirements of the Pizza Bill Generator
Application

3.4 Design and Architecture

The design and architecture of the Pizza Bill Generator App are crucial to ensuring that the application
meets the outlined requirements efficiently. The application is developed using object-oriented
programming principles, with a focus on modularity, reusability, and scalability. This section details the
design approach, the key classes involved, and their interactions.

3.4.1 Class Design

The application is built around a few core classes, each responsible for a specific aspect of the pizza
billing process. The primary classes include:

Pizza (Base Class):

The Pizza class serves as the base class for all types of pizzas. It contains attributes such as price, name,
and methods for calculating the cost based on selected customizations.

VegPizza and NonVegPizza (Derived Classes):

These classes extend the Pizza class to represent Veg and Non-Veg pizzas, respectively. They override
certain methods to include the option for adding extra cheese and toppings.

16
DeluxPizza (Derived Class):

The DeluxPizza class also extends the Pizza class but differs in that it automatically includes extra cheese
and toppings. It represents the Delux variants of pizzas.

BillGenerator (Utility Class):

The BillGenerator class is responsible for managing user inputs, displaying the menu, and generating
the final bill based on the user's selections.

Fig 3.2: Class Diagram Showing the Structure of the Pizza Bill Generator Application

3.4.2 Class Interactions

The interaction between the classes is straightforward and follows the principles of inheritance and
polymorphism. The BillGenerator class orchestrates the user interaction, invoking methods from the
Pizza and its derived classes based on the user's choices.

When a user selects a pizza type, the BillGenerator class creates an instance of the corresponding class
(VegPizza, NonVegPizza, or DeluxPizza). The application then checks if additional options (extra cheese
and toppings) should be presented to the user. For Delux pizzas, these options are skipped, as they are
already included.

Once all the user inputs are collected, the BillGenerator class calculates the total cost, including any
packaging charges, and displays the bill to the user.

Fig 3.3: Sequence Diagram Illustrating the Interaction Between Classes During Bill Generation

3.5 Implementation

The implementation of the Pizza Bill Generator App involves writing the code for the classes described
inthe design section. This section provides a detailed explanation of the code, including key methods
and their functionalities.

17
3.5.1 Pizza Class

The Pizza class is the foundation of the application. It contains attributes such as name, price,
extraCheeseCost, and extraToppingsCost. The class also includes methods to calculate the cost of the
pizza based on whether extra cheese and toppings are added.

public class Pizza {

protected String name;

protected double price;

protected double extraCheeseCost = 20.0;

protected double extraToppingsCost = 30.0;

public Pizza(String name, double price)

{this.name = name;

this.price = price;

public double calculateCost(boolean extraCheese, boolean extraToppings) {

double totalCost = price;

if (extraCheese) {

totalCost += extraCheeseCost;

if (extraToppings) {

totalCost += extraToppingsCost;

return totalCost;

18
public String getName()

{return name;

In the above code snippet, the Pizza class has a constructor to initialize the name and base price of the
pizza. The calculateCost method calculates the total cost by adding the cost of extra cheese and toppings,
if selected.

Fig 3.4: Code Snippet of the Pizza Class Showing the Calculation of Total Cost

3.5.2 VegPizza and NonVegPizza Classes

The VegPizza and NonVegPizza classes extend the Pizza class. These classes represent the standard pizza
options and include the ability to add extra cheese and toppings.

public class VegPizza extends Pizza

{public VegPizza() {

super("Veg Pizza", 150.0);

public class NonVegPizza extends Pizza

{public NonVegPizza() {

super("Non-Veg Pizza", 200.0);

These classes primarily serve to set the specific names and base prices for Veg and Non-Veg pizzas. They
rely on the inherited methods from the Pizza class for cost calculation.

19
Fig 3.5: Code Snippet of the VegPizza and NonVegPizza Classes

3.5.3 DeluxPizza Class

The DeluxPizza class is a special variant that automatically includes extra cheese and toppings. This class
overrides the calculateCost method to ensure that these additions are always included.

java

Copy code

public class DeluxPizza extends Pizza {

public DeluxPizza(String name, double price)

{super(name, price);

@Override

public double calculateCost(boolean extraCheese, boolean extraToppings) {

// Delux pizzas always have extra cheese and toppings

return super.calculateCost(true, true);

In the above code, the DeluxPizza class forces the inclusion of extra cheese and toppings by always
passing true to the calculateCost method.

Fig 3.6: Code Snippet of the DeluxPizza Class with Automatic Cheese and Toppings Inclusion

3.5.4 BillGenerator Class

The BillGenerator class is responsible for managing user interactions and generating the final bill. It
handles the menu navigation, collects user inputs, and calculates the total bill.

20
java

Copy code

import java.util.Scanner;

public class BillGenerator {

public void generateBill() {

Scanner scanner = new Scanner(System.in);

Pizza pizza = null;

System.out.println("Welcome to

Pizzamania!");

System.out.println("Please select the type of pizza:");

System.out.println("1. Veg Pizza");

System.out.println("2. Non-Veg Pizza");

System.out.println("3. Deluxe Veg Pizza");

System.out.println("4. Deluxe Non-Veg Pizza");

choice = scanner.nextInt();

switch (choice)

{case 1:

pizza = new

VegPizza();break;

case 2:

21
pizza = new

NonVegPizza();break;

case 3:

pizza = new

DeluxeVegPizza();break;

case 4:

pizza = new

DeluxeNonVegPizza();break;

default:

System.out.println("Invalid choice!");

return;

if (!(pizza instanceof DeluxeVegPizza) && !(pizza instanceof DeluxeNonVegPizza)) {

System.out.println("Do you want extra cheese? (yes/no)");

String extraCheeseInput = scanner.next();

if (extraCheeseInput.equalsIgnoreCase("yes"))

{pizza.addExtraCheese(true);

System.out.println("Do you want extra toppings? (yes/no)");String

extraToppingsInput = scanner.next();

if (extraToppingsInput.equalsIgnoreCase("yes"))

{pizza.addExtraToppings(true);

22
}

System.out.println("Opt for take away? (yes/no)");

String takeAwayInput = scanner.next();

double bill = pizza.calculatePrice();

if (takeAwayInput.equalsIgnoreCase("yes"))

{bill += 50; // Packaging charges

System.out.println("Your total bill is: Rs " + bill);

23
CHAPTER 4

RESULTS AND DISCUSSION

4.1 Overview of Practical Training

The practical training at the Internship Studio provided an in-depth exposure to Java programming overa
period of 42 days. The primary focus was on enhancing core Java skills, understanding object-oriented
programming principles, and applying these concepts to real-world scenarios. The training also included
hands-on projects, enabling the practical application of theoretical knowledge.

4.2 Development Environment Setup

The first week of the internship was dedicated to setting up the development environment. The setup
included the installation of JDK, configuring IDEs like Eclipse or IntelliJ IDEA, and understanding the
basiccommands required for Java development.

Figure 4.1 - Development Environment Setup

4.3 Core Java Concepts

Throughout the training, core Java concepts were reinforced through various coding exercises and small-
scale projects. This section covers the following key concepts:

4.3.1 Object-Oriented Programming (OOP)

The training revisited the four pillars of OOP: encapsulation, inheritance, polymorphism, and abstraction.

Figure 4.2 - Object-Oriented Programming Example

4.3.2 Exception Handling

Exception handling was thoroughly discussed, with various scenarios being simulated to understand the
try-catch mechanism, custom exceptions, and the importance of finally blocks.

24
Figure 4.3 - Exception Handling Mechanism

4.3.3 Java Collections Framework

The Java Collections Framework was explored with a focus on commonly used interfaces like List, Set,
Map, and their implementations. Various sorting and searching algorithms were also implemented using
collections.

Figure 4.4 - Java Collections Example

4.4 Advanced Java Topics

In the latter half of the training, more advanced topics were introduced, including:

4.4.1 Multithreading

Multithreading and concurrency were crucial topics. The training included writing multithreaded
applications, understanding thread lifecycle, synchronization, and the use of concurrent collections.

Figure 4.5 - Multithreading Example

4.4.2 JDBC (Java Database Connectivity)

The practical sessions covered database connectivity using JDBC. Trainees were tasked with developing
CRUD operations using MySQL databases.

Figure 4.6 - JDBC Connectivity Example

4.4.3 Java Servlets and JSP

Web development fundamentals were covered using Java Servlets and JSP, leading to the creation of
dynamic web applications. The sessions included request-response handling, session management, and
integration with front-end technologies.

Figure 4.7 - Servlets and JSP Example

4.5 Project Implementation

25
The final phase of the training involved implementing a capstone project. The project encapsulated all the
concepts learned during the training, including core Java, advanced topics, and integration of third-party
libraries.

4.5.1 Project Design and Planning

The project began with requirements gathering, system design, and planning using UML diagrams.

Figure 4.8 - Project Design Diagram

4.5.2 Coding and Testing

The coding phase was divided into modules, with rigorous testing conducted after each phase to ensure
functionality and performance.

Figure 4.9 - Project Code Snippet

4.5.3 Final Deployment and Presentation

The project concluded with the deployment on a local server and a final presentation to showcase the
functionality and learning outcomes.

Figure 4.10 - Final Project Deployment

4.6 Discussions and Feedback

4.6.1 Challenges Faced

Several challenges were encountered, such as debugging multithreaded applications, optimizingdatabase


queries, and managing memory in large-scale applications.

4.6.2 Solutions Implemented

The training provided guidance on how to tackle these challenges through best practices, peer
discussions, and instructor-led sessions.

4.6.3 Learning Outcomes

26
By the end of the training, participants demonstrated a solid understanding of Java programming andwere
able to apply these skills in real-world scenarios effectively.

4.7 Conclusion

The 42-day practical training in Java at the Internship Studio significantly enhanced the programming skills
of the participants. The hands-on approach, coupled with real-world projects, provided a comprehensive
understanding of both core and advanced Java concepts. The feedback from participantshighlighted the
effectiveness of the training in bridging the gap between academic learning and industryrequirements.

27
CHAPTER 5

CONCLUSIONS AND FUTURE SCOPE

5.1 Conclusions

The 42-day practical training in Java at the Internship Studio has been a significant learning experience,
offering in-depth exposure to both fundamental and advanced Java concepts. The key conclusions drawn
from the training are:

Enhanced Java Proficiency: The training has provided a comprehensive understanding of Java
programming, particularly in areas such as object-oriented programming, exception handling, and the
Java Collections Framework. Participants have developed a strong foundation in Java, which is crucial
forany software development career.

Practical Application of Theoretical Knowledge: Through hands-on projects and coding exercises,
participants were able to apply theoretical concepts to real-world scenarios. This practical application
reinforced learning and provided a better grasp of complex Java features like multithreading, JDBC, and
web development with Servlets and JSP.

Project-Based Learning: The capstone project at the end of the training encapsulated all the learned
concepts, allowing participants to experience the complete software development lifecycle—from
planning and design to coding, testing, and deployment. This experience has enhanced problem-solving
skills and the ability to work in a team environment.

Overcoming Challenges: Participants faced various challenges, such as debugging, optimizing


performance, and managing large-scale applications. The training provided the necessary tools and
knowledge to overcome these challenges, thus improving the participants' troubleshooting anddebugging
skills.

Industry-Relevant Skills: The training was aligned with industry requirements, ensuring that the skills
learned are directly applicable to real-world jobs. Participants are now well-equipped to handle Java-
based projects in a professional environment.

28
5.2 Future Scope

The practical training has laid a strong foundation, but there is always room for further growth and
learning. The future scope of this training includes:

Advanced Java Frameworks: Participants can build on their core Java knowledge by learning advanced
frameworks such as Spring, Hibernate, and JavaServer Faces (JSF). These frameworks are widely used in
the industry and will open up more opportunities for career advancement.

Microservices and Cloud Integration: With the growing trend of microservices architecture and cloud
computing, gaining expertise in tools like Spring Boot, Docker, Kubernetes, and cloud platforms (e.g., AWS,
Azure) will be beneficial. Integrating Java applications with these technologies will be a crucial nextstep.

Deepening Database Management Skills: Further exploration of database management, including NoSQL
databases like MongoDB, and mastering complex queries, data modeling, and performance optimization,
will enhance backend development skills.

Web Development and Frontend Technologies: While the training covered Java Servlets and JSP,
participants can expand their knowledge by learning frontend frameworks like Angular, React, or Vue.js,
and integrating them with Java backends. This will enable the development of full-stack applications.

Continuous Learning and Certification: To stay competitive in the field, continuous learning is essential.
Participants are encouraged to pursue Java certifications such as Oracle Certified Professional (OCP) to
validate their skills and enhance their professional credibility.

Contribution to Open Source Projects: Engaging with the Java community through contributing to open-
source projects can be a valuable way to gain real-world experience, network with other professionals, and
stay updated with the latest developments in the Java ecosystem.

5.3 Final Thoughts

The 42-day practical training has provided a solid platform for a career in Java development. With the
foundations in place, the future scope offers numerous pathways for participants to deepen theirexpertise,
stay updated with industry trends, and continue growing as proficient Java developers. The knowledge and
skills acquired during this training will serve as a stepping stone to more advanced learningand professional
opportunities

29
REFRENCES

3. 10 References

During the development of the Pizza Bill Generator App, several resources were instrumental in
providing the necessary knowledge and guidance. These references helped in understanding Core Java
concepts and applying them effectively in the project. Below is a list of key references that were
consulted:

Internship Studio Practical Training Materials:

The training sessions provided by the Internship Studio covered essential Java concepts, such as object-
oriented programming, inheritance, polymorphism, and exception handling, which were directly appliedin
this project.

Java Programming Textbooks and Online Resources:

"Effective Java" by Joshua Bloch: This book was particularly useful for understanding best practices in
Java programming.

Oracle’s Java Documentation: The official Java documentation provided detailed explanations of classes
and methods used throughout the project.

Online tutorials and forums, such as Stack Overflow, which offered solutions to specific codingchallenges
encountered during development.

Code Examples and Sample Projects:

Sample projects and code snippets from Java learning platforms helped in structuring the project
andimplementingfeatures like menu-driven interfaces and bill generation logic.

These references collectively contributed to the successful completion of the Pizza Bill Generator App
and provided a solid foundation for future Java development projects.

Including this section not only gives credit to the resources that aided your learning but also strengthens
your report by demonstrating the thoroughness of your research and training.

30
.

31

You might also like