You are on page 1of 78

INTRODUCTION 1BI21AI061

1. INTRODUCTION
1.1 Introduction

The rise in global competition has prompted organizations to devise strategies to have
a talented and innovative workforce to gain a competitive edge. Developing an internship
policy is an impactful strategy for creating a future talent pool for the industry. The Internship
program not only helps fresh pass-outs in gaining professional know-how but also benefits,
corporate on fresh perspectives on business issues and even discovering future business
leaders. The interaction of Technical Institutions with the industries has been restricted to the
level of faculty communications and 2 to 4 hour industrial visits by the students generally. The
institutions are under a great stress to renew education offered by them, to be as close as
possible to the industrial requirement and expectations. Competition in the job sector is rising
exponentially and securing entry-level jobs is getting very difficult, as the students passing
out from technical institutions lack the experience and skills required by industry. AICTE has
initiated various activities for promoting industrial internship at the graduate level in technical
institutes. The main aim of these initiatives is enhancement of the employability skills of the
students passing out from Technical Institutions. AICTE has prepared a model curriculum with
the help of prominent academicians of the country so that the country may produce competent
employable graduates as per the needs of the industries.

1.2 Objectives

Internships are educational and career development opportunities, providing practical


experience in a field or discipline. They are structured, short-term, supervised placements often
focused around particular tasks or projects with defined timescales.

Following are the intended objectives of internship training:

• Will expose Technical students to the industrial environment, which cannot be simulated in
the classroom and hence creating competent professionals for the industry.

• Provide possible opportunities to learn understand and sharpen the real time technical /
managerial skills required at the job.

• Exposure to the current technological developments relevant to the subject area of training.

Dept of AI&ML 2022-2023 2


PERSONALITY 1BI21AI061

2. PERSONALITY DEVELOPMENT
2.1 Introduction

Personality may be hard to define, but we know it when we see it. We all make
personality judgments about the people we know. A major part of coming to understand
ourselves is developing a sense of what our personality characteristic are. We even from
impressions about the personalities of people we do not know but have only read about. In this
paper presentation we are going to see what is personality, factors influencing thepersonality
and types of personality. This study is helps for better understand of each other. Today many
glitches are in our family, community, churches due to misunderstanding and unaware of the
personality types. This study will be an eye-opener for the basic knowledge ofthe personality
and to find our and others personality. Let us first look in to the definition.

Personality development encompasses the dynamic construction and deconstructionof


integrative characteristics that distinguish an individual in terms of interpersonal behavioural
traits. Personality development is ever-changing and subject to contextual factors and life-
altering experiences. Personality development is also dimensional in description and subjective
in nature. That is, personality development can be seen as acontinuum varying in degrees of
intensity and change. It is subjective in nature because its conceptualization is rooted in social
norms of expected behaviour, self-expression, and personal growth. The dominant viewpoint
in personality psychology indicates that personality emerges early and continues to develop
across one's lifespan. Adult personality traits are believed to have a basis in infant temperament,
meaning that individual differences in disposition and behaviour appear early in life, potentially
before language of conscious self-representation develop.

2.2 Objectives

It is well recognised that personal development is a key driver of organisational


performance and employee engagement. A study has found that 80% of employees feel that
learning and development opportunities would make them more engaged at work.

Dept of AI&ML 2022-2023 3


PERSONALITY 1BI21AI061

Emphasising personal development links to employee retention is a vital and on-going


concern for employers. This is why personal development plans (PDPs) form part of many
organisations’ performance management systems. The objective of personality development
is to enhance and improve various aspects of an individual's personality, including their
behaviour, attitudes, thoughts, and emotions. It aims to help individuals develop a well-
rounded and positive personality that enables them to interact effectively with others, achieve
personal and professional goals, and lead a fulfilling life. Some specific objectives of
personality development may include:

● Self-awareness: Developing a deeper understanding of one's own strengths,


weaknesses, values, and beliefs.

● Self-confidence: Building confidence and self-esteem to face challenges, take risks, and
believe in one's abilities.

● Communication skills: Enhancing verbal and non-verbal communication skills to


express thoughts and ideas clearly, listen actively, and engage effectively in
interpersonal interactions.

● Emotional intelligence: Developing emotional awareness, empathy, and the ability to


manage emotions effectively, both in oneself and in relationships with others.

● Leadership skills: Cultivating qualities such as decision-making, problem-solving,


teamwork, adaptability, and resilience to become an effective leader or influencer.

● Positive mindset: Promoting a positive attitude, optimism, and a growth mindset that
fosters continuous learning and personal development.

● Interpersonal skills: Developing skills to build and maintain healthy relationships,


resolve conflicts, and collaborate with others in various social and professional settings.
● Professional development: Enhancing skills related to career advancement, such as time
management, goal setting, networking, and professional etiquette.
● Adaptability and flexibility: Developing the ability to adapt to changing circumstances,
handle uncertainty, and embrace new experiences and challenges.

Dept of AI&ML 2022-2023 4


PERSONALITY 1BI21AI061

● Personal fulfilment: Facilitating personal growth, self-actualization, and a sense of


purpose, leading to a more fulfilling and meaningful life.

It's important to note that personality development is a lifelong process, and the specific
objectives may vary from person to person based on their individual needs, goals, and
circumstances.

● The programme intends to develop talent, facilitate employability enabling the


incumbent to excel and sustain in a highly competitive world of business.
● The programme aims to bring about personality development with regard to the
different behavioural dimensions that have far reaching significance in the direction
of organisational effectiveness.
● The programme aims to cause a basic awareness about the significance of soft skills in
professional and inter-personal communications and facilitate an all-round
development of personality. Hard or technical skills help securing a basic position in
one's life and career.

2.3 Benefits of Personality Development

Personal development is about investing in yourself so that you can manage yourself
effectively regardless of what life might bring your way. The core benefits of Personality
Development are:

● You become happier

The main goal of personal development is to be happier. Naturally, when you


improve yourself, your life, your relationships, achieve your goals, you become
happier. This doesn’t always happen right away or all the time, but it happens in time
with consistent and deliberate personal development.

● Your relationships improve both with yourself and others

Personal development is about improving the relationship with yourself. It at


least normally starts there. When you improve the relationship with yourself, people
are naturally drawn to you and your relationships you already have with others also

Dept of AI&ML 2022-2023 5


PERSONALITY 1BI21AI061

improves. The people you attract are also more likely to be better for you. You attract
people who are at your level so once you start raising your level, the people who come
into your life are going to be at your higher level. Personal development canalso be
dedicated to improving relationships with others whether it be intimate relationships,
friends and family, work relationships, or relationships to people and communities.
Relationships and communication are topics within personal development.

● You learn new things

A major component of personal development is education, learning, and


knowledge. You can not only learn new skills and knowledge and education, but you
also learn about yourself, about others, and about the world and humanity. Through
learning, you learn about different viewpoints, values, beliefs. You learn skills that
aren’t taught in school too like how to set goals and how to have healthy relationships.

● You live better

With more happiness, better relationships, achievements, and a better you, your
quality of life improves. Your life becomes richer in either or both the physical sense
and the metaphorical sense.

● You are better able to adapt to change

When you embrace, accept, and seek change for yourself and your life, you’re
better at accepting and adapting to unexpected or out of your control change whether
good or bad or the change you brought yourself from your personal development. But
with a strong foundation, you’re more likely to be happy and fulfilled with your
achievements, or you’re better able to deal with any of the anxiety and negative
emotions that may arise.

● You’re able to make decisions and solve problems better

Dept of AI&ML 2022-2023 6


PERSONALITY 1BI21AI061

Personal development is meant to help you live more effectively. This helps you
become better able at making better sound decisions and being able better and more
effectively solve any problems that arise.

● You’re healthier

When you’re involved in personal development, you’re more likely to value and
take care of your health. Better health is also a side effect to many personal development
habits. This list shows some habits that help improve your mental and physical health.
Happier people are healthier people.

Setting goals is a major component of personal development. Reaching your


goals is one of the main goals of personal development. With knowledge and use of
personal development techniques, you’re more likely to succeed at reaching your goals.

● You’re more likely to have financial and career success

Because personal development affects all areas of your life and can be applied
to the financial and career area of your life, you’re more likely to achieve success in
that area. How to Win Friends and Influence People is one of the most recommended
books by business leaders and CEOs even though it’s a self-help book. It can be applied
to both personal and work life.

● You inspire others

When you are personally growing and succeeding, others around you are
probably going to notice. Your story, your progress, and your success can inspire
others. This is great if you’re trying to influence or help others to make a change in
themselves which I discussed in this article.

● It feels goods

When you go after your goals and make progress and achievement, it feels really
good. It feels a lot better than if you wouldn’t have worked on personal

Dept of AI&ML 2022-2023 7


PERSONALITY 1BI21AI061

development. And the end result is a lot stronger feeling that makes everything that
made it up that point worth it in ‘the end.’

● It’s interesting

A lot of personal development involves psychology which most of us find interesting.


There is a science to personal development. Hearing people stories of failure and
unexpected success can also be interesting to us. Personal development is always
expanding with new discoveries and studies that we didn’t know before or expected.

● It affects all areas of your life

You can use personal development in all areas of your life. Personal
development in general also affects all areas of your life even if it just being directly
applied to one area. For example, working on and growing your confidence can
positively affect and improve the relationship area of your life and the work area of
your life.

● You become more aware

Awareness is necessary for personal growth. It’s the first step. Awareness helps
you notice and learn things about yourself and your life around you. Awareness is a
highly valuable skill that allows you to realize and learn the facts and stay grounded in
reality. Many people miss out on learning and growth opportunities because of lack of
awareness.

● You think better and become smarter

Personal development can help you make better and more informed decisions.
It also tends to involve reading which actually does make you smarter. All the things
you learn help make you smarter as well.

Dept of AI&ML 2022-2023 8


COMMUNICATION SKILLS 1BI21AI061

3. COMMUNICATION SKILLS

3.1 Introduction

Communication is usually defined as the transmission of information. The term can


also refer to the message itself, or the field of inquiry studying these transmissions, also known
as communication studies. The precise definition of communication is disputed. Controversial
issues are whether unintentional or failed transmissions are included and whether
communication does not just transmit meaning but also create it. Models of communication
aim to provide a simplified overview of its main components and their interaction. Many
models include the idea that a source uses a coding system to express information in the form
of a message.

Communication is the heart of every organization. Everything we do in the workplace


or outside is a result from our communication. Communication not only helps people to
facilitate the process of sharing information and knowledge, but also helps people to develop
relationships with others. Studying communication develops important life skills, critical
thinking, problem solving, conflict resolution, team building, and public speaking.

3.2 Objectives

Communication helps us construct our social world. It allows us to create and maintain
relationships, it helps us participate in civic activities in our community, and strong
communication skills allow us to advance in our careers. Communication influences all aspects
of our public and private lives.

Communication objectives are the reasons that a business or individual may choose to
interact, or communicate, with customers, employees, coworkers or other businesses and what
the business hopes to gain from the exchange. This communication may come in the form of
conversations, written statements, marketing campaigns or any other strategy that conveys
information. Creating objectives before communicating can help a business or individual
develop strategies that guide the content of each instance of communication. This can help
them reach efficiently reach goals.

Dept of AI&ML 2022-2023 9


COMMUNICATION SKILLS 1BI21AI061

Any type of company or organization can create and utilize communication objectives
in the workplace. The term itself can apply to many different areas of a company, such as
marketing, management and leadership. Employees may use communication objectives within
everyday interactions whenever they engage in an act of communication with a set purpose.
Defining the goals that many already employ can help make the communication process more
efficient for all parties.

The course ‘Communication Skills’ is developed and offered with an objective to fulfil
the following learning outcomes:

● Understand and apply communication theory


● Critically think about communication processes and messages
● Write effectively for a variety of contexts and audiences
● Interact skillfully and ethically
● Develop and deliver professional presentations
● Engage in scholarly inquiry and social scientific research
● Recognize the effects of diversity, access, and power on communication

Moreover, to be a successful librarian, it is very important to have effective


communication skills. Being able to communicate effectively can lead us to become more
assertive, have better relationships, and enjoy a happier life.

3.3 Effective Communication

Effective communication is the process of exchanging ideas, thoughts, opinions,


knowledge, and data so that the message is received and understood with clarity and purpose.
When we communicate effectively, both the sender and receiver feel satisfied.

Communication occurs in many forms, including verbal and non-verbal, written, visual,
and listening. It can occur in person, on the internet (on forums, social media, and websites),
over the phone (through apps, calls, and video), or by mail.

For communication to be effective, it must be clear, correct, complete, concise, and


compassionate. We consider these to be the 5 C’s of communication, though they may vary
depending on who you’re asking.

Dept of AI&ML 2022-2023 10


COMMUNICATION SKILLS 1BI21AI061

3.4 Benefits of Effective Communication

The benefits of communication effectiveness can be witnessed in the workplace, in an


educational setting, and in your personal life. Learning how to communicate well can be a boon
in each of these areas.
Effective communication skills reduce misunderstandings and build empathy and
understanding between people, especially in formal relationships, where interactions are often
brief and impersonal. Here’re a few major ways in which effective communication helps:

● Creates better relationships- Relationships built on the solid ground of good


communication tend to be stronger and can even help participants find opportunities for
personal growth. At a fundamental level, better communication builds trust and is
particularly effective in improving teamwork. When multiple people work toward the
same goal, a clear and straightforward communication strategy boosts productivityand
speeds up problem-solving by reducing misunderstanding and confusion.

● Helps handle conflicts better- As we work our team-building muscles and strive for
strong communication, we understand all sides of a conflict to provide better resolution.
Many disagreements happen due to miscommunications or individuals not being heard.
Giving everyone the chance to speak and explain their point of view makes it easier to
prevent conflict and misunderstandings. For example, in the workplace, effective
communication handles conflicts better and strengthens the company’s culture. This
ensures better business success and looks great to recruiters looking for work
environments with high job satisfaction and employee engagement.

● Builds empathy- Understanding why people feel the way they do is the basis of
empathy. When we become active listeners, we boost our personal and professional
relationships through a greater understanding of the people around us and their points
of view. Maintain eye contact (without staring) when talking face-to-face and look for
nonverbal clues from facial expressions and body language. Paying attention this way

Dept of AI&ML 2022-2023 11


COMMUNICATION SKILLS 1BI21AI061

helps us get a fuller picture of our conversation partner’s emotional state and helps us
respond thoughtfully.

● Increases self-awareness- We develop our soft skills and awareness as we continue


to be attentive and understanding. We recognize our own emotions and notice how they
change in certain circumstances. Being self-aware is one of the most important factors
in effectively interacting with others. For example, we might notice that our body
language is “closed” or unfriendly if our arms are crossed and we’re not smiling.
Knowing this, we can begin to understand the importance of different forms of
communication (verbal or nonverbal) and how they affect all parties in aconversation.
Focusing on sitting with open posture and a friendly face will put both parties at ease.

● Builds trust- The benefits of effective communication include encouraging trust in


other people. If our conversation partners know that we value truth and authenticity,
they’re more likely to trust and build stronger relationships with us. When we have
conversations with other great communicators, we reinforce this skill in each other
through attention and feedback.

3.5 Improving Communication Skills

Communication, like any other skill, is one you can improve upon with practice.
Here are a few ways to start improving your communication skills, whether at home or on
the job.

● Create opportunities to communicate: Meetings, hanging out with friends, calling


instead of texting, and joining seminars — these are all opportunities to fine-tune our
skills. Take them when they come. In fact, the more variety in situations and contexts,
the more well-rounded communicators we become. For example, we might
communicate one way in a business or professional context and another way at social
gatherings. We use different nonverbal cues when talking to our colleagues and
supervisors than our families.

Dept of AI&ML 2022-2023 12


COMMUNICATION SKILLS 1BI21AI061

● Practice your tone before communicating: It’s hard to pay attention toourselves
and the speaker during a conversation. So practice self-awareness in your own time.
Think about the tone of your voice in the context of what you’re saying. Are you
striking the right emotional chord with your audience?

● Exercise: Self-awareness and empathy are the two pillars in good communication. For
effective communication, it’s important to consider these factors and give each other
the benefit of the doubt. Focus on what’s important about the message being delivered.

● Go wide on feedback: Feedback helps us improve and hone our skills. Getting a wide
range of feedback helps even more because we interact with a variety of people in
different contexts daily. And what’s appropriate in one environment may be less
effective in another (at a party with old friends). So a great way to refine our
communication skills is to get frequent feedback from different people and contexts.

Dept of AI&ML 2022-2023 13


APTITUDE 1BI21AI061

4. APTITUDE

4.1 Introduction

An aptitude is a component of a competence to do a certain kind of work at a certain


level. Outstanding aptitude can be considered "talent". Aptitude is inborn potential to perform
certain kinds of activities, whether physical or mental, and whether developed or undeveloped.
Aptitude is often contrasted with skills and abilities, which are developed through learning.
The mass term ability refers to components of competence acquired through a combination of
both aptitude and skills.

In general, aptitude tests are more likely to be designed and used for career and
employment decisions, and intelligence tests are more likely to be used for educational and
research purposes. However, there is a great deal of overlap between them, and they often
measure the same kinds of abilities. For example, aptitude tests such as the Armed Services
Vocational Aptitude Battery measure enough aptitudes that they could also serve as a measure
of general intelligence.

4.2 Importance of Aptitude

Aptitude is a very important aspect of a person’s life. By aptitude, we usually refer to


Quantitative aptitude – that basically judges our analytical and problem solving skills. It refers
to your unique abilities as a human being – and how well you are able to apply them to specific
questions.

That’s why it’s one of the most important parts of competitive exams and job
interviews. You will find aptitude-linked questions in almost every exam paper. Why? The
idea is to judge your problem-solving and decision-making skills – which are vital to your
academic/professional performance at large.

In short, Aptitude is what characterizes the analytical and applicational ability of an


individual, because it is very much essential for human to think in complex situations. This is
more evident nowadays than ever, when you can see aptitude as being primary to every
recruitment team’s assessment of you. This is because aptitude is what predicts how you will

Dept of AI&ML 2022-2023 14


APTITUDE 1BI21AI061

perform in your actual job the essentially demonstrates the following ideas your prediction
and observation power.

● Your Memory, Concentration and Calculations.

● Your common sense and presence of mind.

That’s why Aptitude Tests are so important to your performance as a student: they are
a statement of your competence—a certification of your abilities as a candidate.

Having said that, however, there is far more to the nuanced nature of the individual.
You, as a human, are far more than your IQ – which partially links to your performance on
aptitude tests. Equally important are your “EQ” (your emotional quotient), and your social
skills. These are factors beyond the scope of what constitutes Aptitude – but they are just as,
if not more, important as your aptitude.

An individual with a high aptitude test score but a low ability to communicate his ideas
effectively and/or work collaboratively is objectively far less likely to succeed than someone
with a moderate aptitude score but advanced social skills and a high EQ. So here, more than
anywhere else, a balance is crucial.

4.3 Common Aptitude Tests

Examples of aptitude tests include:

● Logical reasoning tests: Logical reasoning tests examine how you come to see the
difference or similarities between patterns and shapes.
● Verbal reasoning tests: Verbal reasoning tests will determine the way you have defined
or obtained information from within short passage or paragraph.
● In-tray exercises: Also called e-tray exercise, in-tray exercises is to determine your
prioritization and organizational abilities required in the workplace.
● Watson Glaser critical thinking tests: The Watson Glaser critical thinking test
determines your ability to analyze any set of information to see how well you understand
it and draw from it a logical conclusion.

Dept of AI&ML 2022-2023 15


APTITUDE 1BI21AI061

● Situational judgment tests: Situational judgment tests measure how you solve problems
at work using various workplace scenarios.
● Numerical reasoning tests: Numerical reasoning tests determine how you use numbers
and calculations to solve mathematical problems.

4.4 Aptitude Training (campus placements)

Every year placement season at college campuses, especially engineering colleges


witnesses tremendous activity and excitement. It is the season of opportunity as well as anxiety
for the candidates who compete for jobs which are offered by various companies. Invariably
this is the first and the most important job for candidates who prepare hard to land up a job in
their dream companies. However, only some of these candidates succeed while others don’t.
Most often the reason for this is the Aptitude test which the candidates have to appear for in
order to get shortlisted for the interview.
These are the ways in which one can prepare for an aptitude test:

● Practice properly
● Know your strengths
● Research deeply
● Manage time appropriately
● Stay focused
● Focus on your basics

Dept of AI&ML 2022-2023 16


JAVA PROGRAMMING 1BI21AI061

5. JAVA PROGRAMMING
5.1 Introduction

Java is a high-level, class-based, object-oriented programming language that is


designed to have as few implementation dependencies as possible. It is a general-purpose
programming language intended to let programmers write once, run anywhere
(WORA),meaning that compiled Java code can run on all platforms that support Java without
the need to recompile. Java applications are typically compiled to byte code that can run on
any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax
of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java
runtime provides dynamic capabilities (such as reflection and runtime code modification) that
are typically not available in traditional compiled languages.

5.2 Object Oriented Programming in JAVA


Object means a real-world entity such as a pen, chair, table, computer, watch, etc.
Object-Oriented Programming is a methodology or paradigm to design a program using classes
and objects. It simplifies software development and maintenance by providing some concepts:
● Object
● Class
● Inheritance
● Polymorphism
● Abstraction
● Encapsulation
5.2.1 Object

An entity that has state and behavior is known as an object e.g., chair, bike, marker,
pen, table, car, etc. It can be physical or logical (tangible and intangible). The example of an
intangible object is the banking system.

An object has three characteristics:

● State: represents the data (value) of an object.

Dept of AI&ML 2022-2023 17


JAVA PROGRAMMING 1BI21AI061

● Behavior: represents the behavior (functionality) of an object such as deposit,


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

For Example, Pen is an object. Its name is Reynolds; color is white, known as its
state. It is used to write, so writing is its behavior.

An object is an instance of a class. A class is a template or blueprint from which


objects are created. So, an object is the instance(result) of a class.

Object Definitions:

● An object is a real-world entity.


● An object is a runtime entity.
● The object is an entity which has state and behavior.
● The object is an instance of a class.

5.2.2 Class

A class is a group of objects which have common properties. It is a template or


blueprint from which objects are created. It is a logical entity. It can't be physical.

A class in Java can contain:

o Fields
o Methods
o Constructors
o Blocks
o Nested class and interface

Syntax to declare a class:


class <class_name>{
field;
method;
}

Dept of AI&ML 2022-2023 18


JAVA PROGRAMMING 1BI21AI061

5.2.3 Inheritance
Inheritance in Java is a mechanism in which one object acquires all the properties and
behaviours of a parent object. It is an important part of OOPs (Object Oriented programming
system). The idea behind inheritance in Java is that you can create new classes that are built
upon existing classes. When you inherit from an existing class, you can reuse methods and
fields of the parent class. Moreover, you can add new methods and fields in your current class
also. Inheritance represents the IS-A relationship which is also known as a parent-child
relationship
Types of Inheritance:
● Single Inheritance
● Multilevel Inheritance
● Hierarchical Inheritance
● Multiple Inheritance
● Hybrid Inheritance
Why use inheritance in java
● For Method Overriding (so runtime polymorphism can be achieved).
● For Code Reusability.

Terms used in Inheritance


● Class: A class is a group of objects which have common properties. It is a template or
blueprint from which objects are created.
● Sub Class/Child Class: Subclass is a class which inherits the other class. It is also
called a derived class, extended class, or child class.
● Super Class/Parent Class: Superclass is the class from where a subclass inherits the
features. It is also called a base class or a parent class.
● Reusability: As the name specifies, reusability is a mechanism which facilitates you to
reuse the fields and methods of the existing class when you create a new class. You can
use the same fields and methods already defined in the previous class.

5.2.4 Polymorphism
Polymorphism is considered one of the important features of Object-Oriented
Programming. Polymorphism allows us to perform a single action in different ways. In other
words, polymorphism allows you to define one interface and have multiple implementations.
The word “poly” means many and “morphs” means forms, so it means many forms.

Dept of AI&ML 2022-2023 19


JAVA PROGRAMMING 1BI21AI061

Types of polymorphism in JAVA:


In JAVA polymorphism is mainly divided into two types:
● Compile-Time Polymorphism
It is also known as static polymorphism. This type of polymorphism is achieved
by function overloading or operator overloading.
● Runtime Polymorphism
It is also known as Dynamic Method Dispatch. It is a process in which a function
call to the overridden method is resolved at Runtime. This type of polymorphism is
achieved by Method Overriding.
Polymorphism in Java is the task that performs a single action in different ways.

So, languages that do not support polymorphism are not ‘Object-Oriented Languages’, but
‘Object-Based Languages’. Ada, for instance, is one such language. Since Java supports
polymorphism, it is an Object-Oriented Language.

Polymorphism occurs when there is inheritance, i.e., many classes are related.

5.2.5 Abstraction
In Java, abstraction is achieved by interfaces and abstract classes. We can achieve 100%
abstraction using interfaces. Data Abstraction may also be defined as the process of identifying
only the required characteristics of an object ignoring the irrelevant details. The properties and
behaviours of an object differentiate it from other objects of similar type and also help in
classifying/grouping the objects.
Abstract classes are used to define a generic template for other classes to follow. They
define a set of rules and guidelines that their subclasses must follow. By providing an abstract
class, we can ensure that the classes that extend it have a consistent structure and behavior.
This makes the code more organized and easier to maintain.

A class which is declared as abstract is known as an abstract class. It can have abstract
and non-abstract methods. It needs to be extended and its method implemented. It cannot be
instantiated.

Dept of AI&ML 2022-2023 20


JAVA PROGRAMMING 1BI21AI061

Points to Remember
● An abstract class must be declared with an abstract keyword.
● It can have abstract and non-abstract methods.
● It cannot be instantiated.
● It can have constructors and static methods also.
● It can have final methods which will force the subclass not to change the body of the
method.

5.2.6 Encapsulation

Encapsulation is one of the key features of object-oriented programming. Encapsulation


refers to the bundling of fields and methods inside a single class. It prevents outer classes from
accessing and changing fields and methods of a class. This also helps to achieve data hiding.

Encapsulation is a fundamental concept in object-oriented programming (OOP) that


refers to the bundling of data and methods that operate on that data within a single unit, which
is called a class in Java. Encapsulation is a way of hiding the implementation details of a class
from outside access and only exposing a public interface that can be used to interact with the
class.

In Java, encapsulation is achieved by declaring the instance variables of a class as


private, which means they can only be accessed within the class. To allow outside access to the
instance variables, public methods called getters and setters are defined, which are used to
retrieve and modify the values of the instance variables, respectively. By using getters and
setters, the class can enforce its own data validation rules and ensure that its internal state
remains consistent.
Advantages of Encapsulation:
● Data Hiding.
● Increased Flexibility.
● Reusability.
● Testing code is easy.
● Easy and fast to create a encapsulated class.

Dept of AI&ML 2022-2023 21


JAVA PROGRAMMING 1BI21AI061

● Provide efficient control over the data.


● The fields of the class can be made read-only or write-only.
● Secured access to the data.

5.3 Advantages of Object Oriented Programming (OOP)


● We can build the programs from standard working modules that communicate with one
another, rather than having to start writing the code from scratch which leads to saving
of development time and higher productivity,
● OOP language allows to break the program into the bit-sized problems that can be
solved easily (one object at a time).
● The new technology promises greater programmer productivity, better quality of
software and lesser maintenance cost.
● OOP systems can be easily upgraded from small to large systems.
● It is possible that multiple instances of objects co-exist without any interference,
● It is very easy to partition the work in a project based on objects.
● It is possible to map the objects in problem domain to those in the program.
● The principle of data hiding helps the programmer to build secure programs which
cannot be invaded by the code in other parts of the program.
● By using inheritance, we can eliminate redundant code and extend the use of existing
classes.
● Message passing techniques is used for communication between objects which makes
the interface descriptions with external systems much simpler.

5.4 Benefits of Using JAVA programming Language


The advantages of Java are as follows:
● Java is easy to learn.
Java was designed to be easy to use and is therefore easy to write, compile, debug,
and learn than other programming languages.
● Java is object-oriented.
This allows you to create modular programs and reusable code.
● Java is platform-independent.

Dept of AI&ML 2022-2023 22


JAVA PROGRAMMING 1BI21AI061

One of the most significant advantages of Java is its ability to move easily from one
computer system to another. The ability to run the same program on many different
systems is crucial to World Wide Web software, and Java succeeds at this by being
platform-independent at both the source and binary levels.

Java is a Class-based Programming Language

You will often hear that Java is an object-oriented programming language (OOP) and built on
OOP principles, which makes code more structured, maintainable, and reusable. However, for
language purists, this is not quite true, as Java supports the use of primitive types, which are
not a feature of OOP languages. However, for all intents and purposes, Java can still be referred
to as object-oriented as it still supports OOP concepts such as classes and objects,
polymorphism, and inheritance.

Java is Human Readable

Java is a high-level programming language, versus a machine language. This means that the
syntax, for the most part, can be viewed by a human and understood without the person needing
to know the nuances of code (mostly). That does not mean that a non-programmer can
understand every line of your code; it simply means that a developer should be able to read
most parts of your codebase and get a list of what you are trying to accomplish. This is doubly
so if you practice proper Java coding best practices, which we always advise.

Multithreading in Java

When a programming language has multithreading as a feature, it means that the programmer
can create more than one thread at a time. Think of a thread as a task – the smallest part of a
process. Multithreading allows developers to take full advantage of the central processing unit
(CPU) so that multiple threads can run concurrently – or, simply put, multiple
processes can run at the same time. This makes programs more efficient and faster.

Dept of AI&ML 2022-2023 23


JAVA PROGRAMMING 1BI21AI061

Java is Secure and Stable

Java has been around for quite some time and is an open source programming language,
meaning its codebase is viewable and modifiable. It also means that the Java community and
the supporters of Java (formerly Sun Microsystems, currently Oracle), have invested an
inordinate amount of time testing, fixing, upgrading, and add features to the language. And
they continue to do so, as new versions and patches are still released (and will be into the
foreseeable future; Java is not going anywhere.)Because of Java's robustness, ease of use,
cross-platform capabilities and security features, it has become a language of choice for
providing worldwide Internet solutions.

Dept of AI&ML 2022-2023 24


WEB PROGRAMMING IN GO 1BI21AI061

6. WEB PROGRAMMING IN GO
6.1 Introduction

The Go programming language is one of the many high-level languages that can be
used for web development. The criteria for choosing any one of them can include performance,
convenience, learning curve, available libraries, and any other number of considerations.
Although the end result is the same, the decisive factor is how quickly and conveniently we
can create a web application. PHP, Java, and C# are all excellent and proven in this field. The
standard library support of Go, however, makes web development particularly easy,
convenient, and quick.
With Golang, web developers simply need the Go compiler and nothing else to get started
developing web pages and web apps. The built-in features of Go already include a web server
and the net/http package in the standard library, which provides the necessary functions
required for working with the HTTP protocol.

6.2 Benefits of using Golang for Web Development


Since its initial release of version 1.0 in 2012, the Go language has demonstrated its
robustness. Let’s explore 10 advantages of using Golang for software development.
● Simplified Code
● Powerful performance
● The go-to language for large-scale Projects
● Designed for multi-core processors
● Designed for the Internet
● Fast garbage collection
● Easy to learn
● Easy maintenance
● Open source approach
● Golang is industry agnostic
Go is very powerful when it comes to concurrency. It is easier to create applications that
effectively utilize modern multi-core and networked machines while keeping neat and modular
programming code.

Dept of AI&ML 2022-2023 25


WEB PROGRAMMING IN GO 1BI21AI061

Go is perfect for web development with its smart library, steady performance, solid security,
and clean syntax.
6.3 Web Development Basics
The Go Programming Language, also known as Golang, offers a powerful development
environment for building web applications. Statically typed and similar to C in its syntax, Go
offers structural type, memory safety, and garbage collection, and has becomea popular choice
for web development. In this course, we learnt the basics of web development with Go,
including the way web applications work, how HTTP factors into web development, web
architectures, and the structure of web applications. We also explored web development with
Go and how web applications work. Next, we learnt about the role ofHTTP in web
development, including how to create HTTP requests and generate HTTP responses. Then, we
examined web architectures and how web applications are structured, including the purpose of
multiplexing and http.Handler wrappers. Finally, we learnt about the Go template package and
how to create a basic structured web application using Go.

6.3.1 Objectives

● How web applications work and the benefits of web applications


● The role of HTTP in web programming and the differences between HTTP 1.x and 2
● HTTP requests and HTTP request methods and headers
● Demonstrated how to create HTTP requests using Go
● HTTP responses and HTTP response status codes and headers
● Demonstrated how to test HTTP using the httptest package in Go
● The role of web architectures and clean methods for structuring web applications
● Best practices for structuring Go web applications
● The purpose and features of multiplexing and how the Go multiplexer package is used
● The purpose and features of http.Handler wrappers in Go
● The purpose and features of the Go template package
● Demonstrated how to create a basic structure for a Go web application

Dept of AI&ML 2022-2023 26


WEB PROGRAMMING IN GO 1BI21AI061

6.3.2 Course Summary

In this course, we've examined Go web development basics. We did this by exploring
how web applications work and the role of HTTP, HTTP requests, how to create them and
HTTP responses, testing HTTP using the httptest package, web architectures, structuring Go
web applications and multiplexing in Go, http.Handler wrappers and the Go template package
and creating a structured Go application.

6.4 Working with Templates in Go

In web application development, HTML is frequently combined with data from


template engines using handlers. In the Go programming language, templates are utilized along
with other actions and commands to display content. In this course, we will learn about Go
templates and functions and how to use them in the creation of web applications. First, we will
explore templates in Go and template engines, as well as how to parse and execute templates.
Next, we will examine actions in Go and how to implement them. We will also learn about Go
arguments, flags, variables, and pipelines. Finally, we will learn about Go functions and how
to use them.

6.4.1 Objectives

● The purpose and features of templates and the Go template packages


● The purpose and features of template engines
● Demonstrated how to parse and execute templates in Go
● The purpose of actions in Go templates, including conditional actions, iterator actions,
set actions, and include actions
● Demonstrated how to implement actions in Go
● The purpose and features of arguments, pipelines, and variables in Go templates
● Demonstrated how to utilize arguments in Go
● Demonstrated how to implement flags in Go
● Demonstrated how to utilize variables in Go
● Demonstrated how to implement pipelines in Go
● The purpose and features of template functions in Go

Dept of AI&ML 2022-2023 27


WEB PROGRAMMING IN GO 1BI21AI061

6.4.2 Course Summary

In this course we've examined templates, actions and functions and Go. We did this by
exploring. Go template package and template engine features. Parsing and executing templates
in Go. Implementing Go actions.

Using Go arguments, flags, variables, and pipelines. And working with functions in Go.

6.5 Data Storage in Go

In web application development, data storage is utilized in a number of ways, including


in memory, in files, and in relational databases. In the Go Programming Language (also known
as Golang), data storage can be used persistently to improve performance. In this course, we
will learn about data storage in Go and how to utilize it in the creation of web applications.
First, we will learn about data storage in Go and template engines, including the purpose of
persistent storage and how implement in-memory storage using structs. Then we will learn
about the concept of working with gobs and SQL and how to store and retrieve datafrom a SQL
database. Finally, we will learn about SQL mappers and how to utilize them in Go.

6.5.1 Objectives

● How web applications store or persist data and the purpose of structs in Go
● Implement in-memory storage using structs
● Utilize gob streams
● The purpose and features of working with SQL databases in Go, The data in a database
is typically more structured and formally organized than in a file system. There are
many different databases out there that Go can interface with. SQL databases store data
in tables that are relational. The SQL language allows data to be queried in a standard
way. Key-value stores are not relational, but instead, each object stored has a unique
key that can be used to access it.
● Store and retrieve data from a SQL database using the Go sql package

Dept of AI&ML 2022-2023 28


WEB PROGRAMMING IN GO 1BI21AI061

6.5.2 Course Summary

In this course, we've examined data storage in Go. We did this by exploring
implementing in-memory storage using structs, working with gob streams and SQL databases,
storing and retrieving data from a SQL database using Go, and using SQL mappers in Go.

6.6 Web Services in Go

In web application development, web services are used to provide functionality to


applications. In the Go programming language, you can use existing web services or create
your own. In this course, you'll learn about web services in Go and how to implement them.
First, you'll explore web services, including SOAP and RESTful web services and how they
compare to each other. Then you'll learn how to implement web services and how to work with
XML and JSON files. Finally, you'll examine how to create a RESTful web service using Go.

6.6.1 Objectives

● Web services and how they relate to programming in Go


● SOAP and RESTful web services, as well as and their benefits, similarities, and
differences.
● Demonstrated how to implement web services using Go
● Demonstrated how to work with and parse XML files using Go
● Demonstrated how to encode and decode JSON files using Go
● Demonstrated how to create a simple RESTful web service using Go

SOAP is often used for reliable enterprise-level applications. REST-based web services
are simpler services than SOAP that allow for stateless interaction, meaning that requests to
the service are not dependent on previous requests. A third type of web service called RPC-
based is particularly good at relaying actions efficiently between client andserver. One thing
that all web services have in common is their platform independence.

Dept of AI&ML 2022-2023 29


WEB PROGRAMMING IN GO 1BI21AI061

6.6.2 Course Summary

In this course, we've examined Web Services in Go. We did this by exploring SOAP
and RESTful web services and Go, implementing web services, working with XML and JSON,
and creating a RESTful web service using Go.

6.7 HTML Forms & ResponseWriter in Go

POST requests are typically served up as HTML forms. In the Go programming


language, you can handle forms using a number of functions. In this course, we will learn
how to work with HTML forms and how to use ResponseWriter. First, we will explore the
concept of HTML forms and how HTTP POST requests are handled. Then we will examine
the Go ResponseWriter package and how to work with it. Finally, we will learn aboutresponse
headers in Go and how to with JSON output.

6.7.1 Objectives

● The purpose and features of HTML forms in Go and how HTTP POST requests are
handled. The URL has a finite short maximum length. So submitting forms with the
GET action is usually only done for very simple forms. Additionally, the document
body of the POST action is not normally visible in the browser. Whereas, with the GET
request URL name-value pairs are clearly visible in a browser, so sending form data
via the GET action might be insecure. There's an attribute on the HTML form called
enctype. This stands for encoding type and it has two possible values. The default value
is application/x-www-form-urlencoded. The other valid value is multipart/form-data.
● Demonstrated form handling in Go with the Form, PostForm, and MultipartForm
functions
● The purpose and features of ResponseWriter in Go
● Demonstrated how to work with the ResponseWriter package in Go
● The purpose and features of response headers in Go
● Demonstrated how to set response headers in Go
● How JSON output can be leveraged in Go

Dept of AI&ML 2022-2023 30


WEB PROGRAMMING IN GO 1BI21AI061

6.7.2 Course Summary

In this course, we've examined HTML forms in ResponseWriter in Go. We did this by
exploring working with HTML forms in Go, working with ResponseWriter, setting response
headers, and working with JSON output.

6.8 Creating a Go Web Server

In the Go programming language (also known as Golang), the net/http library is used
for creating web servers that receive requests and send responses. In this course, we will learn
how to create a Go web server. First, we will explore the Go net/http package and how to create
a basic Go web server, including how to serve files using HTTP. We will also examine how to
work with Go handlers, including working with multiple handlers and chaining handlers.
Finally, we will learn about ServeMux and DefaultServeMux and how to implement routing
using the httprouter library.

6.8.1 Objectives

● The purpose and features of the Go net/http package. The net/http package contains
objects and methods that allow you to program HTTP clients which send HTTP
requests, and HTTP servers which listen for request on a particular port, process the
requests and send back responses.
● The package also allows for either HTTP communication which is not encrypted and
therefore less secure, or HTTPS communication which is encrypted and secured
communication.
● Build a basic Go web server using the net/http package
● Demonstrated how to serve files with HTTP using Go
● Handlers and handler functions in Go
● Demonstrated how to implement handlers and handler functions in Go
● Demonstrated how to handle and process requests with multiple handlers

Dept of AI&ML 2022-2023 31


WEB PROGRAMMING IN GO 1BI21AI061

● Chaining handlers and handler functions


● Demonstrated using the ServeMux and DefaultServeMux handlers in Go
● The purpose and features of the Go httprouter package
● Demonstrated how to implement routing using the httprouter package

6.8.2 Course Summary

In this course, we've examined creating a Go web server. We did this by exploring the
Go net/http package and building a basic Go web server, using Go to serve files with HTTP,
working with Go handlers, multiple handlers, and chaining handlers, ServeMux and
DefaultServeMux handlers in Go, and using the Go httprouter library for router.

Dept of AI&ML 2022-2023 32


DEFENSIVE PROGRAMMER: DEFENSIVE TECHNIQUES 1BI21AI061

7. DEFENSIVE PROGRAMMER: DEFENSIVE


TECHNIQUES

7.1 Introduction

In this course, we discover the importance of exception handling, validation, and


parameter checking in programming. Explore how to handle exceptions and apply validation
in Java, Python, C#, and Javascript, as well as how to configure component trust and reuse
code, in this course. Begin by learning how to apply exception handling effectively, and then
take a look at validation techniques and procedures. We will explore reliability, resiliency, and
recoverability and how it can be achieved in software engineering. Next, we will look at
CDI/UDI (constrained data item/unrestrained data item), why it is important, and how it should
be done. We will delve into parameter checking; using Java exception handling; using Python
exception handling, and using Javascript exception handling. We will then explore using Java
validation; Python validation; C# validation, and Javascript validation. In the final tutorials We
will examine component trust, including when and how to achieve trust of components, and
learn how to reuse code effectively and defensively.

7.2 Objectives

● apply exception handling effectively


● describe validation techniques and procedures
● describe reliability, resiliency, and recoverability and how it can be achieved in
● software engineering
● describe CDI/UDI, why it is important and how it should be done
● apply parameter checking
● use Java exception handling
● use Python exception handling
● use C# exception handling
● use JavaScript exception handling
● use Java validation
● use Python validation
● use C# validation
● use JavaScript validation

Dept of AI&ML 2022-2023 33


DEFENSIVE PROGRAMMER: DEFENSIVE TECHNIQUES 1BI21AI061

● describe component trust including when and how to achieve trust of components
● describe how to reuse code effectively and defensively

7.3 Course Summary

We started with discussing exception handling. How to do it properly, when to do it,


where to do it, what sorts of exception handling messages to provide to the user or to technical
personnel.

Then we moved into data validation, describing when, where, and how to validate data.
We looked a great deal at reliability, resiliency, and recoverability. Making sure our software
is reliable, meaning that it provides accurate data and can be depended upon to actually execute
properly. That it's resilient, meaning that it is resistant to failure, andrecoverable, meaning that
if it does fail, it can bounce back without any significant loss of data.

We then moved into user input, filtering it, constraining it, guiding the user toproviding
the proper input in the proper format that you desire, and this led to parameter checking,
particularly parameters being passed to functions. All of these various techniques were
described in enough detail, for you to apply them to your own programming projects. So
what's up next? In the next course, you'll learn basic cryptography, with specific examplesof
how to implement cryptography in Java, JavaScript, C#, and Python.

Dept of AI&ML 2022-2023 34


JAVA MINI PROJECT 1BI21AI061

8. JAVA MINI PROJECT

8.1 Introduction

This report is based on the Inter College Internship Programming carried out by
Bangalore Institute of Technology for the year 2022 for the first year students at the end of their
first year course. It is done as per the guidelines issued by Visvesvaraya Technological
University (VTU). The goal of the internship being to indulge in outcome based learning
initiations and inculcate attributes that fall within the graduate attributes defined by the NBA.

To test the skill and knowledge attained by the students over the course of their
internship is tested by giving them a problem statement to solve using their creativity and their
understanding of the internship subject. Over the course of this report we have incorporated
the knowledge of JAVA that we have gotten over the course of the internship into solving the
problem statements.

The problem statement introduced is a combination of various problems that are based
on theentirety of JAVA programming. The problem statement given is such that it uses all the
concepts of python and with each part of the problem statement being a problem that revolves
around a certain concept in JAVA. This report contains various topics and concepts of JAVA
that are combined together to cover and solve the problem statement. All the concepts of JAVA
are incorporated together to solve various aspects of the problem. The application is reduced
as much as possible to avoid errors while entering the data.

Dept of AI&ML 2022-2023 35


JAVA MINI PROJECT 1BI21AI061

8.2 Objective

This report contains various topics and concepts of JAVA that are combined together to
coverand solve the problem statement. All the concepts of JAVA are incorporated together to
solvevarious aspects of the problem.

The report contains the information about the System architecture used in the project.
Systemarchitecture is the visualization of the program model or a conceptual model that defines
the behaviour, structure and working of a system.

A system architecture can consists of system components and the assembly of the
subsystems, that will work together to implement the overall system.

The report contains the description of the tools and techniques that are used to implement
theworking of the overall problem statement. It contains the information and explanation about
the tools and technologies, the reason why they are used in the problem, the role that they play
and description about their features and other details.

The report then contains the notes and the written reflection of the thought process that
went into implementing the project report, about their self-assessment and experience
throughout them working on their project. It also contains the non-technical take-outs that have
been taken from the project, like improvement in vocalization skills, communication skills,
time management and more.
Overall the internship was an excellent and effective step for students to sharpen their skills
and learn new ones to add to their portfolios and resumes. It also created and opportunity for
them to learn and practice team working and effective communicative skills and enhance
their knowledge and make them ready for acing entry-level jobs.

Dept of AI&ML 2022-2023 36


JAVA MINI PROJECT 1BI21AI061

8.3 System Analysis

A text-based adventure game is a type of interactive fiction where the player reads
through a story and makes choices that affect the outcome. These games usually have simple
graphics and are driven by text input from the player. Text adventures are gamesthat put heavy
focus on text-based interactions with the game world and the charactersliving inside of it. The
player has to make choices in every step of the game, and basedon these choices, the storyline
changes.

8.3.1Aim of the project


 The main agenda of this game is to show people how they can think and play and
not get carried away with the graphics-based games which leads them to just get
addictedwithout any thoughts.

 The graphics game will only get you addicted and have disadvantages like
spoilingthe eye or having headaches after a certain period of time.

 The graphic games will not have any option to think the possibilities of what is
goingto happen if I choose one option or the other which can lead to just get
carried into the as per the designer.

8.4 Proposed System

User : A user is a person who utilizes a computer or network service.


A user often has a user account and is identified to the system by a username (or user name).
Other terms for username include login name, screenname (or screen name), account name,
nickname (or nick) and handle, which is derived from the identical citizens band radio term.
But in this game user is the one who plays the game.

User Interface: User Interface (UI) defines the way humans interact with the information
systems. In Layman’s term, User Interface (UI) is a series of pages, screens, buttons, formsand
other visual elements that are used to interact with the device. Every app and every website has
a user interface.

Dept of AI&ML 2022-2023 37


JAVA MINI PROJECT 1BI21AI061

User Interface (UI) Design is the creation of graphics, illustrations, and use of
photographicartwork and typography to enhance the display and layout of a digital product
within its various device views. Interface elements consist of input controls (buttons, drop-
down menus, data fields), navigational components (search fields, slider, icons, tags),
informationalcomponents (progress bars, notifications, message boxes).A good User Interface
(UI) focuses on making user’s interactions simple and efficient. User would appreciate a
website with intuitive user interface that leads them towards their task in most engaging way.
User Interface (UI) design focuses on thinking of a user, what they might need to do when they
visit website and ensure that the interface has elements that are easy to access and understand.
Being a UI designer, one need to understand the goals, skills, preferences and tendencies ofthe
user to make a better interface.

Server: In computing, a server is a piece of computer hardware or software (computer program)


that provides functionality for other programs or devices, called "clients". This architecture
is called the client–server model. Servers can provide various functionalities, often called
"services", such as sharing data or resources among multiple clients or performing computations
for a client. A single server can serve multiple clients, and a single client can use multiple
servers. A client process may run on the same device or may connect over a network to a server
on a different device. Typical servers are database servers, file servers, mail servers, print
servers, web servers, game servers, and application servers.
Client–server systems are usually most frequently implemented by (and often identified with)the
request–response model: a client sends a request to the server, which performs some action
and sends a response back to the client, typically with a result or acknowledgment. Designatinga
computer as "server-class hardware" implies that it is specialized for running servers on it. This
often implies that it is more powerful and reliable than standard personal computers, but
alternatively, large computing clusters may be composed of many relatively simple, replaceable
server components.

Authentication and Authorization : In cyber security, authentication is the process of


verifying someone's or something's identity. Authentication usually takes place by checking a
password, a hardware token, or some other piece of information that proves identity. Just as an
airline worker checks a passport or an identification card to verify a person's identity whenthey
board a plane, computer systems need to be sure a person really is who they say they are. At an
airport, this authentication process ensures only people with a ticket get on the plane; for digital
systems, this ensures data is viewed and used by the right people.

Authentication does not just apply to verifying human users. Computer systems also need to
check servers, software, APIs, and other computers to be sure they are who they "say" they are.

Dept of AI&ML 2022-2023 38


JAVA MINI PROJECT 1BI21AI061

8.4 Objective of proposed system

Abstract: This document provides an in-depth overview of the technology stack and tools
used in the development of the a text-based adventure game. The application's primary
objective is to create a user-friendly and visually engaging interface that displays using Java
Swing. The report delves into the significance of each technology and tool and explains how
they contribute to the successful implementation of the application's functionalities. The
development environment, libraries, and other relevant tools are explored in detail to offer a
comprehensive understanding of the application's architecture.

Introduction: Text-based adventure game is designed to provide users with an interactive


interface for playing text games. To accomplish this, a robust technology stack and appropriate
tools are essential. The report outlines the use of Java programming language andJava Swing
framework as the core technologies, as well as other supporting tools that facilitate the
development process.

Java Programming Language: Java is a widely-used object-oriented programming language


known for its platform independence, making it suitable for cross-platform applications. It
offers robustness, scalability, and an extensive standard library, which simplifies the
development process and allows for efficient implementation of complex functionalities in the
Data Visualization App.

Java Swing: Java Swing is a comprehensive GUI toolkit that serves as the backbone of the
Electricity Bill System’s graphical user interface. It provides a wide array of components
,such as JFrame, JPanel, and My SQL, that enable developers to create dynamic and
interactive interface. Swing's event handling capabilities ensure responsiveness, allowing
users to interact with the charts seamlessly.

Integrated Development Environment (IDE): An Integrated Development Environment,


such as Eclipse or IntelliJ IDEA, streamlines the development process by offering a rich set
of features like code auto-completion, syntax checking, and debugging tools. IDEs enhance
developers' productivity and collaboration, making it easier to manage the project and improve
code quality.

Dept of AI&ML 2022-2023 39


JAVA MINI PROJECT 1BI21AI061

Random Class: Java's built-in ‘java.util.Random’ class is utilized to generate random data
for the bar chart and pie chart. The Random class provides methods to create random integers
within specified ranges, allowing the application to populate the charts with diverse and
dynamic data points for a more representative visualization.

Scalability and Extensibility: The chosen technology stack and tools offer scalability,
enabling the user to sign in securely and play the game and appropriate management of the
system. - Java's modular approach and object-oriented nature make it easier to extend and
addnew features to the application in a structured manner.

Accessibility: Java Swing's built-in accessibility features ensure that the game is accessibleto
users with both customers and as well as admin.

User Interaction: The application's user-friendly interface allows users to interact with the
system easily, providing all the required facilities as sign up , sign in , play securely . Admin
can monitor the whole system.

Real-time Data Updates: To cater to dynamic data scenarios, the app can be extended to
update the user information in real-time when the users update their details, providing users
with up-to date their profiles.

Error Handling and Validation: Robust error handling and data validation mechanismscan
be incorporated to ensure the application gracefully handles unexpected data or user input.

Performance Optimization: The project can include performance optimization techniques


to ensure smooth responses, even for both customers and admins.

Cross-Platform Compatibility: Java's platform independence ensures that the text- based
adventure game can run seamlessly on multiple operating.

Dept of AI&ML 2022-2023 40


JAVA MINI PROJECT 1BI21AI061

8.6 System Design

The provided code is an implementation of a text-based adventure game in Java,


utilizing theSwing library for creating the graphical user interface. The game presents a player
with different scenarios and choices as they navigate through a fictional world. The main class
"game" sets up the window and defines various panels, buttons, and labels required for the
game interface. It also includes inner classes for handling user input during the game, such as
starting the game, making choices, and interacting with NPCs and monsters.

The game starts with a title screen displaying the title "ADVENTURE" and a
"START" button. When the player clicks on the "START" button, the main game screen is
created, presenting the player with a text area for narrative and buttons for making choices.
The player's character has health points (HP) and can carry a weapon, initially set to “KNIFE”.
The game involves various scenarios, such as encountering a guard at the town gate, crossinga
road with different directions, finding a river, entering a forest to discover a sword,
encountering a goblin, and engaging in fights. The player's choices impact their HP, the
monster's HP, and whether they win or lose the game.

The goal of the game is to defeat the monster, which rewards the player with a silver
ring anda message from the guard welcoming them to the town. However, losing the game
displays a"Game over" message. The player can choose to play again or exit the game after
either winning or losing.

Dept of AI&ML 2022-2023 41


JAVA MINI PROJECT 1BI21AI061
Implementation

import java.awt.Color; import


java.awt.Container; import
java.awt.Font; import
java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class game {


JFrame window;
Container con;
JPanel titlepanel,startpanel,maintextpanel,choicebuttonpanel,playerpanel;
JLabel titlelabel,hplabel,hplabelno,weaponlabel,weaponlabelno;
Font titlefont = new Font("Times New Roman", Font.PLAIN, 90);
JTextArea maintextarea;
int playerhp,monsterhp,silverring;
String weapon,position;
JButton startbutton,choice1,choice2,choice3,choice4;
titlescreenhandler tshandler = new titlescreenhandler();
choicehandler chhandler = new choicehandler();
public static void main(String[] args){
new game();
}

Dept of AI&ML 2022-2023 42


JAVA MINI PROJECT 1BI21AI061

public game(){
window = new JFrame();
window.setSize(800,600);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.getContentPane().setBackground(Color.black);
window.setLayout(null);
window.setVisible(true);
con = window.getContentPane(); titlepanel
= new JPanel(); titlepanel.setBounds(100,
100, 600, 150);
titlepanel.setBackground(Color.black);
titlelabel = new JLabel("ADVENTURE");
// titlelabel.setBounds(100, 50, 1000, 30);
titlelabel.setForeground(Color.WHITE);
titlelabel.setFont(titlefont);
startpanel = new JPanel();
startpanel.setBounds(0,400,1000,1000);
startpanel.setBackground(Color.BLACK);
startbutton = new JButton("START");
//startbutton.setBounds(0,100, 100,50);
startbutton.setBackground(Color.yellow);
startbutton.setForeground(Color.red);
startbutton.addActionListener(tshandler);
// startbutton.setFocusPainted(false);
titlepanel.add(titlelabel);
startpanel.add(startbutton);
con.add(titlepanel);
con.add(startpanel);
}

Dept of AI&ML 2022-2023 43


JAVA MINI PROJECT 1BI21AI061

public void creategamescreen(){


titlepanel.setVisible(false);
startpanel.setVisible(false);
maintextpanel = new JPanel();
maintextpanel.setBounds(100, 100, 600, 250);
maintextpanel.setBackground(Color.YELLOW);con.add(maintextpanel);
maintextarea = new JTextArea("main text area");
maintextarea.setBounds(100,100,600,250);
maintextarea.setBackground(Color.BLACK);
maintextarea.setForeground(Color.WHITE);
maintextarea.setLineWrap(true);
maintextpanel.add(maintextarea); choicebuttonpanel
= new JPanel(null, false);
choicebuttonpanel.setBounds(250,350,300,300);
choicebuttonpanel.setVisible(true);
choicebuttonpanel.setBackground(Color.BLACK);
con.add(choicebuttonpanel);

choice1 = new JButton("choice1");


choice1.setBounds(100, 0, 200, 50);
choice1.setBackground(Color.black);
choice1.setForeground(Color.BLACK);
choice1.addActionListener(chhandler);
choice1.setActionCommand("c1");
// choice1.setVisible(true);
choicebuttonpanel.add(choice1);
choice2 = new JButton("choice2");
choice2.setBounds(100, 50, 200, 50);
choice2.setBackground(Color.black);

Dept of AI&ML 2022-2023 44


JAVA MINI PROJECT 1BI21AI061

choice2.setForeground(Color.BLACK);
choice2.addActionListener(chhandler);
choice2.setActionCommand("c2");
choicebuttonpanel.add(choice2);

choice3 = new JButton("choice3");


choice3.setBounds(100, 100, 200, 50);
choice3.setBackground(Color.black);
choice3.setForeground(Color.black);
choice3.addActionListener(chhandler);
choice3.setActionCommand("c3");
choicebuttonpanel.add(choice3);

choice4 = new JButton("choice4");


choice4.setBounds(100, 150, 200, 50);
choice4.setBackground(Color.black);
choice4.setForeground(Color.black);
choice4.addActionListener(chhandler);
choice4.setActionCommand("c4");
choicebuttonpanel.add(choice4);

playerpanel = new JPanel(null, false);


playerpanel.setBounds(100, 700, 1000, 50);
playerpanel.setBackground(Color.white);
playerpanel.setLayout(new GridLayout(1, 4, 0, 0));
con.add(playerpanel);

hplabel = new JLabel("HP:");


hplabel.setForeground(Color.black);
playerpanel.add(hplabel);

Dept of AI&ML 2022-2023 45


JAVA MINI PROJECT 1BI21AI061

hplabelno = new JLabel();


hplabelno.setForeground(Color.black);
playerpanel.add(hplabelno);

weaponlabel = new JLabel("WEAPON:");


weaponlabel.setForeground(Color.black);
playerpanel.add(weaponlabel);

weaponlabelno = new JLabel(null, null, 0);


weaponlabelno.setForeground(Color.black);
playerpanel.add(weaponlabelno);

playersetup();
}

public void playersetup(){


playerhp = 15;
monsterhp = 20;
weapon = "KNIFE";
weaponlabelno.setText(weapon);
hplabelno.setText(""+playerhp);
towngate();
}

public void towngate(){


position = "towngate";
maintextarea.setText("you are at the gate of the town.\nA gaurd is standing infront of
you.What do you do? ");
choice1.setText("talk to the guard");
choice2.setText("attack the guard");

Dept of AI&ML 2022-2023 46


JAVA MINI PROJECT 1BI21AI061

choice3.setText("leave");
choice4.setText("");
}
public void talkguard(){
position = "talktoguard";
maintextarea.setText("Guard: hello stranger. im sorry but we cannot let any
stranger enter our town. ");
choice1.setText(">");
choice2.setText("");
choice3.setText("");
choice4.setText("");
}

public void attackguard(){


position = "attackguard";
maintextarea.setText("guard: hey dont be stupid!\n\n the guard fought back andhit you
hard\nyou recieve 3 damage");
playerhp = playerhp - 3;
hplabelno.setText(""+playerhp);
choice1.setText(">");
choice2.setText("");
choice3.setText("");
choice4.setText("");
}

public void crossroad(){


position = "crossroad";
maintextarea.setText("you are at a crossroad.\n if you go south,you will go backto
town");
choice1.setText("go north");
choice2.setText("go east");

Dept of AI&ML 2022-2023 47


JAVA MINI PROJECT 1BI21AI061

choice3.setText("go south");
choice4.setText("go west");
}

public void north(){


position = "north";
maintextarea.setText("there is a river.\nyou drink the water and rest\nyour hp isrecovered
by 2");
if(playerhp>=15){
playerhp=15;
}
else{
playerhp = playerhp+2;
}
hplabelno.setText(""+playerhp);
choice1.setText("go south");
choice2.setText("");
choice3.setText("");
choice4.setText("");
}

public void east(){


position = "east";
maintextarea.setText("you walk into a forest and found a long sword\nyou obain
it");
weapon = "sword";
weaponlabelno.setText(weapon);
choice1.setText("go west");
choice2.setText("");
choice3.setText("");
choice4.setText("");

Dept of AI&ML 2022-2023 48


JAVA MINI PROJECT 1BI21AI061

public void west(){


position = "west";
maintextarea.setText("YOU ENCOUNTER A GOBLIN ");
choice1.setText("FIGHT");
choice2.setText("RUN");
choice3.setText("");
choice4.setText("");
}

public void fight(){


position = "fight";
maintextarea.setText("monster HP "+ monsterhp +"\nwhat do you do");
choice1.setText("ATTACK");
choice2.setText("RUN");
choice3.setText("");
choice4.setText("");
}

public void playerattack(){


position = "playerattack"; int
playerdamage = 0;
if(weapon.equals("KNIFE")){
playerdamage = new java.util.Random().nextInt(3);
}
else if(weapon.equals("sword")){
playerdamage = new java.util.Random().nextInt(8);
}
maintextarea.setText("you attacked the monster and gave"
+playerdamage+"damage");

Dept of AI&ML 2022-2023 49


JAVA MINI PROJECT 1BI21AI061

monsterhp = monsterhp - playerdamage;


choice1.setText(">"); choice2.setText("");
choice3.setText("");
choice4.setText("");
}

public void monsterattack(){


position = "monsterattack"; int
monsterdamage = 0;
monsterdamage = new java.util.Random().nextInt(4);
maintextarea.setText("the monster attacked you and
gave"+monsterdamage+"damage");
playerhp = playerhp - monsterdamage;
hplabelno.setText( ""+playerhp);
choice1.setText(">");
choice2.setText(""); choice3.setText("");
choice4.setText("");
}

public void win(){


position = "win";
maintextarea.setText("you defeated the monster\nyou obtain a silver ring");silverring = 1;
choice1.setText("east");
choice2.setText("");
choice3.setText("");
choice4.setText("");
}

Dept of AI&ML 2022-2023 50


JAVA MINI PROJECT 1BI21AI061

public void lose(){


position = "lose";
maintextarea.setText(("you are dead\nGame over"));
choice1.setText("PLAY again"); choice2.setText("exit");
choice3.setText("");
choice4.setText("");
}

public void ending(){


position = "ending";
maintextarea.setText("GUARD: you have obtained a silver ring\nwelcome to ourtown");
choice1.setText("RESTART");
choice2.setText("EXIT");
choice3.setText("");
choice4.setText("");
}

public class titlescreenhandler implements ActionListener{


public void actionPerformed(ActionEvent event){
creategamescreen();
}
}

public class choicehandler implements ActionListener{


public void actionPerformed(ActionEvent event){
String yourchoice = event.getActionCommand();
switch(position){
case "towngate":

Dept of AI&ML 2022-2023 51


JAVA MINI PROJECT 1BI21AI061

switch(yourchoice){
case "c1": if(silverring==1) ending();
else
talkguard();
break;
case "c2": attackguard(); break;
case "c3": crossroad();break;
}
break;
case "talktoguard":
switch(yourchoice){
case "c1": towngate(); break;
}
break;
case "attackguard":
switch(yourchoice){
case "c1": towngate();
break;
}
break;

case "crossroad":
switch(yourchoice){
case "c1": north();break;
case "c2": east(); break;
case "c3": towngate(); break;
case "c4": west();break;
}

Dept of AI&ML 2022-2023 52


JAVA MINI PROJECT 1BI21AI061

break;

case "north":
switch(yourchoice){
case "c1": crossroad();break;
}
break;

case "east":
switch(yourchoice){
case "c1": crossroad();break;
}
break;

case "west":
switch(yourchoice){
case "c1": fight();break;
case "c2": crossroad();break;
}
break; case
"fight":
switch(yourchoice){
case "c1": playerattack();break;
case "c2": crossroad(); break;
}
break;
case "playerattack":
switch(yourchoice){
case "c1": if(monsterhp<1)
win();

Dept of AI&ML 2022-2023 53


JAVA MINI PROJECT 1BI21AI061

else
monsterattack();
break
}
break;
case “monsterattack”:
switch(yourchoice){
case “c1”: if(playerhp<1)
lose();
else
fight();
break;
}break;
case "win":
switch(yourchoice){
case "c1": crossroad();break;
}
break;
}
}
}
}

Dept of AI&ML 2022-2023 54


JAVA MINI PROJECT 1BI21AI061

8.7 Result

Dept of AI&ML 2022-2023 55


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

9. WEB DEVELOPMENT PROJECT


9.1 Introduction
Project Go Speed is a project that aims to develop a new internet speed test app that is
more accurate and reliable than existing apps. The project is being led by a team of engineers
and scientists from Google, and it is still in the early stages of development.

The main goal of Project Go Speed is to create an app that can accurately measure the
speed of an internet connection, regardless of the location or the time of day. The app will use
multiple servers to test the connection, and it will also take into account factors such as the
distance between the server and the device, the amount of traffic on the network, and the type
of connection (Wi-Fi or mobile data).

In addition to being accurate, Project Go Speed also aims to be reliable. The app will
be tested extensively to ensure that it provides consistent results. The app will also be easy to
use and will have a user-friendly interface.

Project Go Speed is still in the early stages of development, but it has the potential to
revolutionize the way we test internet speeds. The app could help consumers to get a better
understanding of their internet connections and to make informed decisions about their internet
service providers.

Here are some of the features that Project Go Speed could have:

1. The ability to test the speed of your Wi-Fi network and your mobile data connection
2. The ability to test the speed of your internet connection over time, so you can see if it
is getting slower or faster
3. The ability to test the speed of your internet connection to specific websites or
services
4. The ability to test the speed of your internet connection in different locations
5. A user-friendly interface that is easy to understand and use

Dept of AI&ML 2022-2023 56


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

9.2 System Analysis

A system analysis of a speed test app that uses Go as the backend and Flutter as the frontend
would typically include the following components:

● Backend: The backend is responsible for handling the data processing and storage for
the application. It would typically be implemented using Go, which is a high-
performance, concurrent programming language. The backend would need to be able
to handle a large number of requests simultaneously, as well as store and retrieve data
efficiently.
● Frontend: The frontend is responsible for displaying the data to the user and handling
user input. It would typically be implemented using Flutter, which is a cross-platform
UI toolkit. The frontend would need to be responsive and user-friendly, as well as be
able to communicate with the backend efficiently.
● Database: The database would be used to store the data for the application. It would
typically be a relational database, such as MySQL or PostgreSQL. The database would
need to be scalable and reliable, as well as be able to handle a large amount of data.
● Networking: The networking layer would be responsible for communicating between
the backend and frontend. It would typically use HTTP or HTTPS to communicate
between the two components. The networking layer would need to be secure and
reliable, as well as be able to handle a large number of requests simultaneously.
● Security: The security layer would be responsible for protecting the application from
unauthorized access. It would typically use encryption and authentication to protect the
data. The security layer would need to be robust and secure, as the application would
be handling sensitive data.

Dept of AI&ML 2022-2023 57


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

In addition to these components, there would also be a number of other considerations for the
system analysis, such as:

● The target audience for the application


● The features that the application will need to have
● The performance requirements for the application
● The budget for the development of the application
● The timeline for the development of the application

By carefully considering all of these factors, I have developed a system analysis that
will help to successfully develop and deploy speed test app.

Here are some of the benefits of using Go as the backend and Flutter as the frontend for a speed
test app:

● Go is a high-performance language that can handle a large number of requests


simultaneously.
● Flutter is a cross-platform UI toolkit that can be used to develop apps for both iOS
and Android.
● Go and Flutter are both open-source languages, which means that there is a large
community of developers who can help you with your project.

Overall, Go and Flutter are a good choice for developing a speed test app. They are both
powerful and versatile languages that can be used to create high-performance and user-friendly
apps.

Dept of AI&ML 2022-2023 58


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

9.3 Proposed System


The backend would be implemented using Go and would be responsible for handling
the data processing and storage for the application. It would use a relational database, such as
MySQL or PostgreSQL, to store the data. The backend would also be responsible for
communicating with the frontend and providing the results of the speed test.

The frontend would be implemented using Flutter and would be responsible for
displaying the data to the user and handling user input. It would use HTTP or HTTPS to
communicate with the backend. The frontend would also be responsible for displaying the
results of the speed test in a user-friendly way.

Here is a more detailed overview of the system:

1. Backend: The backend would be implemented as a microservice architecture. This


means that the application would be divided into small, independent services that can
be scaled and deployed independently. The backend services would be responsible for
the following tasks:
● Handling user requests
● Processing the data from the speed test
● Storing the data in the database
● Communicating with the frontend
2. Frontend: The frontend would be implemented as a single-page application (SPA). This
means that the entire application would be loaded in the user's browser when they first
open the app. The frontend would be responsible for the following tasks:
● Displaying the data to the user
● Handling user input
● Communicating with the backend
3. Database: The database would be used to store the data for the application. It would
typically be a relational database, such as MySQL or PostgreSQL. The database would
need to be scalable and reliable, as well as be able to handle a large amount of data.
4. Networking: The networking layer would be responsible for communicating between
the backend and frontend. It would typically use HTTP or HTTPS to communicate

Dept of AI&ML 2022-2023 59


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

between the two components. The networking layer would need to be secure and
reliable, as well as be able to handle a large number of requests simultaneously.
5. Security: The security layer would be responsible for protecting the application from
unauthorized access. It would typically use encryption and authentication to protect the
data.The security layer would need to be robust and secure, as the application would be
handling sensitive data.

This is just a proposed system for a speed test app that uses Go as the backend and
Flutter as the frontend. There are many other ways to implement this system, and the specific
implementation would depend on the specific requirements of the application.

9.4 Objective of proposed system


● Quick and accurate: The speed test should be quick and easy to use, and it should
provide accurate results. This is important because users need to be able to get a quick
and reliable assessment of their internet speed.
● Detailed information: The speed test should provide users with detailed information
about their internet speed, such as download speed, upload speed, and ping. This
information can be used by users to troubleshoot problems with their internet
connection or to compare their internet speed to other users in their area.
● Comparison: The speed test should allow users to compare their internet speed to
other users in their area. This can be helpful for users to see if their internet speed is
within the expected range or if they are experiencing slower speeds than other users in
their area.
● Reporting: The speed test should allow users to report problems with their internet
connection to their internet service provider. This can help the internet service provider
to identify and resolve problems with their network.
● Data collection: The speed test should collect data on internet speeds in different areas.
This data can be used to improve the performance of internet networks.
● Speed over time: The speed test should allow users to test the speed of their internet
connection over time. This can be helpful for users to see if their internet speed is
getting slower or faster.
● Speed to specific websites or services: The speed test should allow users to test the

Dept of AI&ML 2022-2023 60


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

speed of their internet connection to specific websites or services. This can be helpful
for users to see if their internet speed is sufficient for the activities they want to do
online.
● Speed in different locations: The speed test should allow users to test the speed of
their internet connection in different locations. This can be helpful for users who
travel frequently or who want to compare the internet speeds of different providers.
● Tips on how to improve internet speed: The speed test should provide users with tips
on how to improve their internet speed. This can include tips on how to optimize their
devices, how to troubleshoot problems, and how to choose the right internet service
provider.
● Sharing speed test results: The speed test should allow users to share their speed test
results with others. This can be helpful for users to compare their results to others or
to get help from other users who have experienced similar problems.
The specific objectives of the system would need to be carefully considered to ensure that the
system meets the needs of the users.

9.5 System Requirement Specification


Software:

- Programming language: GO
- Operating system : Mac OS, Windows, Linux
- VS Code IDE

Hardware:

- Processor : Apple Silicon M1 Chip


- Ram : 16GB
- Laptop : Apple Macbook Pro
- System type : 64-bit Operating System

Dept of AI&ML 2022-2023 61


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

9.6 System Design


The system would be divided into two main components:
● Backend: The backend would be responsible for handling the data processing and
storage for the application. It would use a relational database, such as MySQL or
PostgreSQL, to store the data. The backend would also be responsible for
communicating with the frontend and providing the results of the speed test.
● Frontend: The frontend would be responsible for displaying the data to the user and
handling user input. It would use HTTP or HTTPS to communicate with the backend.
The frontend would also be responsible for displaying the results of the speed test in a
user-friendly way.
● Microservices: The backend would be implemented as a microservice architecture. This
means that the application would be divided into small, independent services that can
be scaled and deployed independently. The backend services would be responsible for
the following tasks:
○ Handling user requests
○ Processing the data from the speed test
○ Storing the data in the database
○ Communicating with the frontend
● Frontend: The frontend would be implemented as a single-page application (SPA). This
means that the entire application would be loaded in the user's browser when they first
open the app. The frontend would be responsible for the following tasks:
○ Displaying the data to the user
○ Handling user input
○ Communicating with the backend
● Database: The database would be used to store the data for the application. It would
typically be a relational database, such as MySQL or PostgreSQL. The database would
need to be scalable and reliable, as well as be able to handle a large amount of data.
● Networking: The networking layer would be responsible for communicating between
the backend and frontend. It would typically use HTTP or HTTPS to communicate
between the two components. The networking layer would need to be secure and
reliable, as well as be able to handle a large number of requests simultaneously.

Dept of AI&ML 2022-2023 62


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

● Security: The security layer would be responsible for protecting the application from
unauthorized access. It would typically use encryption and authentication to protect the
data. The security layer would need to be robust and secure, as the application would
be handling sensitive data.

Here are some of the benefits of using this system design:


● The microservice architecture makes the application scalable and reliable.
● The single-page application design makes the application user-friendly and responsive.
● The relational database is scalable and reliable, and it can handle a large amount of data.
● The secure networking layer protects the application from unauthorized access.
● Overall, this system design is a good choice for a speed test app that uses Go as the
backend and Flutter as the frontend. It is scalable, reliable, and secure, and it can be
easily implemented.

Implementation
package main

import (
"encoding/json"
"fmt"
"io"
"log"
"math"
"net/http"
"regexp"
"sync"
"time"
)

var count = 0

Dept of AI&ML 2022-2023 63


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

var lastCount = 0
var mu sync.Mutex

func main() {

// Get https://fast.com html response


res, err := http.Get("https://fast.com")
if err != nil {
log.Fatal("Unable to access fast.com", err)
}

defer res.Body.Close()

// Parse the html


body, err := io.ReadAll(res.Body)

if err != nil {
log.Fatal("Unable to read from fast.com", err)
}

// RegExp for extracting the path to the script.js file, usually found in <script> HTML
tag
rForScriptFileId := regexp.MustCompile(`src\=\"\/app-(.*?)\.js\"`)

// Find all matches


scriptFileIdMatch := rForScriptFileId.FindStringSubmatch(string(body))
if len(scriptFileIdMatch) == 0 {
log.Fatal("Unable to find js file. May be renamed from app-*.js pattern.")
}

scriptFileId := scriptFileIdMatch[1]

Dept of AI&ML 2022-2023 64


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

// For getting the JS file


res, err = http.Get("https://fast.com/app-" + scriptFileId + ".js")
if err != nil {
log.Fatal("Unable to access fast.com", err)
}

h, err := io.ReadAll(res.Body)
if err != nil {
log.Fatal("Unable to read from fast.com", err)
}

// To extract the token that is present in script.js file


r := regexp.MustCompile(`token\:\"(.*?)\"`)
tokenMatch := r.FindStringSubmatch(string(h))
if len(tokenMatch) == 0 {
log.Fatal("Unable to find token in js file. May be renamed.")
}
token := tokenMatch[1]

// Hitting the https://fast.com api to get the download URLs


res, err = http.Get("https://api.fast.com/netflix/speedtest?https=true&token=" + token)
if err != nil {
log.Fatal("Unable to access api.fast.com", err)
}

j, err := io.ReadAll(res.Body)
fmt.Println(string(j))
if err != nil {
log.Fatal("Unable to read from api.fast.com", err)
}

// URLs to download files

Dept of AI&ML 2022-2023 65


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

var urls []map[string]string


json.Unmarshal(j, &urls)

ticker := time.NewTicker(500 * time.Millisecond)


done := make(chan bool)

// Starting new GoRouting


go func() {
for {
select {
case <-done:
return
case <-ticker.C:
mu.Lock()
diff := count - lastCount
lastCount = count
mu.Unlock()

log.Println("Speed", prettyByteSize(diff*2*8)+"bps")
}
}
}()

//Start timer
start := time.Now()
var wg sync.WaitGroup
for _, v := range urls {
wg.Add(1)

url := v["url"]

// Run concurrently

Dept of AI&ML 2022-2023 66


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

go func() {
defer wg.Done()
downloadUrl(url)
}()
}
wg.Wait()
end := time.Since(start)

log.Println("Downloaded data size:", prettyByteSize(count)+"B")


log.Println("Average speed: ",
prettyByteSize(int(float64(count*8)/end.Seconds()))+"bps")
ticker.Stop()

done <- true


}

func downloadUrl(url string) {


log.Println("Downloading", url)

res, err := http.Get(url)


if err != nil {
log.Fatal(err)
}

buf := make([]byte, 1024*1024*10)


for {
n, err := res.Body.Read(buf)
mu.Lock()
count = count + n
mu.Unlock()

if err != nil {

Dept of AI&ML 2022-2023 67


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

break
}
}
}

// ref:
https://gist.github.com/anikitenko/b41206a49727b83a530142c76b1cb82d?permalink_comme
nt_id=4467913#gistcomment-4467913
func prettyByteSize(b int) string {
bf := float64(b)
for _, unit := range []string{"", "K", "M", "G", "T", "P", "E", "Z"} {
if math.Abs(bf) < 1024.0 {
return fmt.Sprintf("%3.1f %s", bf, unit)
}
bf /= 1024.0
}
return fmt.Sprintf("%.1f Y", bf)
}
9.7 Result

Dept of AI&ML 2022-2023 68


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

9.8 Conclusion & Future Enhancements


The system design described above is a good starting point for developing a speed test
app. It is scalable, reliable, and secure, and it can be easily implemented. However, there are
a number of ways to improve the system design. For example, the following enhancements
could be considered:

● Add more features: The system could be enhanced to include additional features, such
as the ability to test the speed of the internet connection over time, to test the speed of
the internet connection to specific websites or services, or to test the speed of the
internet connection in different locations.
● Use a different database: The system could use a different database, such as a NoSQL
database, which is more scalable and efficient for storing large amounts of data.
● Use a different networking layer: The system could use a different networking layer,
such as a WebSocket, which would allow for real-time communication between the
backend and frontend.
● Add more security features: The system could be enhanced to include more security
features, such as two-factor authentication, to protect the application from unauthorized
access.

Here are some of the future enhancements that could be made to the system:
● Add the ability to test the speed of a mobile data connection: The current system only
allows users to test the speed of their Wi-Fi connection. The system could be enhanced
to allow users to test the speed of their mobile data connection as well.
● Add the ability to test the speed of a specific website or service: The current system
only provides the overall speed of the internet connection. The system could be
enhanced to allow users to test the speed of a specific website or service.
● Add the ability to test the speed of the internet connection in different locations: The
current system only allows users to test the speed of their internet connection in one
location. The system could be enhanced to allow users to test the speed of their internet
connection in different locations.
● Add the ability to provide tips on how to improve internet speed: The current system
only provides the raw results of the speed test. The system could be enhanced to

Dept of AI&ML 2022-2023 69


WEB PROGRAMMING IN GO PROJECT 1BI21AI061

provide tips on how to improve internet speed, such as restarting the router or modem,
moving closer to the router, or changing the channel that the router is using.
● Make the system more user-friendly: The current system is relatively easy to use.
However, it could be made even more user-friendly by adding features such as a tutorial
or a help section.
These are just some of the future enhancements that could be made to the system. The specific
enhancements that are made would depend on the specific requirements of theapplication and
the needs of the users.

Dept of AI&ML 2022-2023 70


CONCLUSION 1BI21AI061

CONCLUSION
This internship has been very useful for the overall development. This internship included
personality development training, aptitude training, training on communication skills, java
programming and web programming. Throughout the training, I have gained a deeper
understanding of myself, my strengths, and areas for improvement. The training has provided
me with valuable insights into effective communication, interpersonal skills, time
management, and emotional intelligence. I have learned techniques to enhance my
confidence, leadership abilities, and problem-solving skills. Overall, this personality
development training has empowered me to become a more well-rounded individual,
equipped with the tools and mindset necessary to thrive in various aspects of life.

The training has provided me with a strong foundation in quantitative and logical reasoning,
critical thinking, and mathematical concepts. Through various practice exercises and
assessments, I have developed the ability to approach complex problems systematically and
find efficient solutions. The training has also improved my time management and decision-
making abilities, enabling me to tackle challenges with confidence and precision.
Additionally, the aptitude training has enhanced my overall cognitive abilities and mental
agility, making me more adept at handling real-world scenarios that require quick thinking
and adaptability

In conclusion, the internship has provided me with a comprehensive understanding of both


Java programming and web development in Golang. Through hands-on projects and practical
exercises, I have gained proficiency in Java, mastering concepts such as object-oriented
programming, data structures, and algorithms. This knowledge has equipped me with the
skills to develop robust and scalable Java applications. Additionally, the exposure to web
programming in Golang has been invaluable. I have learned how to leverage Golang's
simplicity and efficiency to build web servers, handle HTTP requests, and work with
databases. This experience has broadened my horizons and allowed me to explore a different
language and framework for web development. Overall, the combination of Java
programming and web development in Golang has provided me with a wellrounded skill set,
empowering me to tackle diverse software development challenges in the future.

Dept of AI&ML 2022-2023 71


REFERENCES 1BI21AI061

REFERENCES

[1]. irjet.net/archives/V8/i10/IRJET.

[2].V8I1023https://www.academia.edu/31518791/Blood_Bank_Management_System_A_Pro
ject.
[3]. https://reachingself.com/26-personal-development-benefits/
[4]. https://www.javatpoint.com/object-and-class-in-java

Dept of AI&ML 2022-2023 72


APPENDIX 1BI21AI061

APPENDIX

Dept of AI&ML 2022-2023 73


APPENDIX 1BI21AI061

Dept of AI&ML 2022-2023 74


APPENDIX 1BI21AI061

Dept of AI&ML 2022-2023 75


APPENDIX 1BI21AI061

Dept of AI&ML 2022-2023 76


APPENDIX 1BI21AI061

Dept of AI&ML 2022-2023 77


APPENDIX 1BI21AI061

Dept of AI&ML 2022-2023 78


APPENDIX 1BI21AI061

Dept of AI&ML 2022-2023 79

You might also like