Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
21 views64 pages

Java Report

The document is an internship report submitted by students Jayesh BN and Abhishek Sharma from the Bangalore Institute of Technology, focusing on soft skills and programming. The internship, conducted from October 11 to October 30, 2022, included training in personality development, communication skills, aptitude, and JAVA programming. The report outlines the objectives of the internship program, highlights key learnings, and acknowledges the guidance received from faculty and trainers.

Uploaded by

Abhishek Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views64 pages

Java Report

The document is an internship report submitted by students Jayesh BN and Abhishek Sharma from the Bangalore Institute of Technology, focusing on soft skills and programming. The internship, conducted from October 11 to October 30, 2022, included training in personality development, communication skills, aptitude, and JAVA programming. The report outlines the objectives of the internship program, highlights key learnings, and acknowledges the guidance received from faculty and trainers.

Uploaded by

Abhishek Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

BANGALORE INSTITUTE OF TECHNOLOGY

K.R. Road, V.V. Pura


Bengaluru – 560 004.
www.bit-bangalore.edu.in
Affiliated to VTU, Jnana Sangama, Belagavi – 590 018.

Inter Institutional Internship Report on

“Soft Skills and Programming”


Submitted in partial fulfilment of the requirement for the award of the degree of

Bachelor of Engineering in
Electronics and Communication Engineering
Submitted by by
Submitted
JAYESH BN
USN: 1BI21EC010
ABHISHEK SHARMA
USN : 1BI21EC065
Under the the
Under Guidance of of
Guidance
DR DDR
VIJAYLAKSHMI
Vijayaprakash A.M
Assistant Professor
Department of Electronics and Communication Engineering
Bengaluru.
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
BANGALORE INSTITUTE OF TECHNOLOGY
October 2022
BANGALORE INSTITUTE OF TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
K R Road, V V Pura, Bengaluru - 560 004
www.bit-bangalore.edu.in
Affiliated to VTU, Jnana Sangama, Belagavi – 590 018

CERTIFICATE

This is to certify that Mr. ABHISHEK


JAYESH BN bearing
SHARMA USNUSN:
bearing 1BI21EC065
1BI21EC010hashas
successfully submitted the report on the Inter/ Intra Institutional Internship
Program conducted during the intervening period of II and III semesters from
11.10.2022 to 30.10.2022. The internship program was on personality
development and communication skills, aptitude, JAVA programming.

Internship Guide Professor and Head

Examiners: Date:

Name Signature

1.

2.
ACKNOWLEDGEMENT

On the successful completion of the Inter/ Intra college internship program, I would like to
acknowledge and extend my heartfelt gratitude to the following people who have made the
completion of this internship program possible.
I am thankful to Dr. M.U.Aswath, Principal, BIT, Bengaluru, for providing wonderful work
environment for completing this internship training program.
I wish to express my genuine appreciation to Dean - Academics Dr. H. B. Balakrishna,
Professor and Head, Department of Civil Engineering, BIT, for his expertise, valuable
guidance and for his kind availability in providing continuous advice and feedback
throughout the course of this program which resulted in the successful completion of my
internship report.
I would like to express my gratitude to Dean – Skill Development Dr. K. M. Roopa,
Professor, Department of Mathematics, BIT, for encouragement and support in completing
this report.
I would like to express my sincere thanks to Dr. J. Girija, Professor and Head, Computer
Science and Engineering Department, Mr. Pavan Kumar M, JAVA trainer and full stack
developer, Prof. Vidyashree A. L. and Prof. Neetha Das, Assistant Professor, Computer
Science and Engineering Department, BIT for all the support extended to train us in JAVA.
My heartfelt thanks to Prof. Anjan Kumar B S, Assistant Professor, Department of
Electronics and Instrumentation, for all the assistance.
I would like to thank Mr. James and Mr. Hilal Patel from ETHNUS for the very interesting
and useful sessions on soft skills and aptitude.
I take this opportunity to thank all the faculty members and supporting staff of the Civil
Engineering Department for their kind assistance and encouragement.
I also thank my parents, family members and all my friends for their unceasing motivation,
inspiration and support.

JAYESH BN

USN:
USN:1BI21EC065
1BI21EC010
10
ABHISHEK SHARMA

i
ABSTRACT

The students of engineering have to undergo internship as per the guidelines issued by the
Visvesvaraya Technological University. The internship program is inter/ intra college activity
conducted by the college authorities. The internship after second semester is 2 credit course
and students have to spend at least 90 hours of their time.

The program contains soft skills training and programming skill development. Based on the
discussion in the academic council it was proposed to conduct training on personality
development and communication skills, aptitude training, JAVA programming.

Personality embraces moods, attitudes, and opinions and is most clearly expressed in
interactions with other people. It includes behavioural characteristics, both inherent and
acquired, that distinguish one person from another and that can be observed in people's
relations to the environment and to the social group. Personality development can help
students to develop the communication skills they need to be successful in their studies.
Leadership is an important quality for success in any field. Students who want to achieve
success in their chosen career path need to be able to lead others.

Communication today is very important both in the business world and in private life.
Successful communication helps us better understand people and situations. It helps us
overcome diversities, build trust and respect, and create conditions for sharing creative ideas
and solving problems.

An aptitude test plays an important role in understanding the personality of the person.
Students can gain the requisite skills based on the outcome of the aptitude assessment which
helps them succeed in their chosen career or profession. Aspiring engineers possess an
aptitude for mathematical computation and scientific thinking that makes them well-suited to
the profession. Their personality tends to be detail-oriented, logical and conscientious.

JAVA is a simple programming language. Java makes writing, compiling, and debugging
programming easy. It helps to create reusable code and modular programs. Java is a class-
based, object-oriented programming language and is designed to have as few implementation
dependencies as possible.

ii
TABLE OF CONTENTS

Chapter Contents Page No.


No.

1 Introduction

1.1Introduction 1

1.2Objectives 2

2 Personality Development 3

3 Communication skills 5

4 Aptitude 6

5 PYTHON or JAVA programming 8

6 Conclusion 11

7 References 12

8 Appendix (If any) 13

iii
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.

Competition in the job sector is rising exponentially and securing entry-level jobs is getting
very difficult, so it’s important for the students to get experience and also to develop skills
required by industry. The main aim of these initiatives is enhancement of the employability
skills of the students passing out from Technical Institutions. The internship experience will
augment outcome-based learning process and inculcate various attributes in a student in line
with the graduate attributes defined by the NBA.

This internship program helps to build industrial relations, makes the placement process
easier. Improve institutional credibility & branding, helps in retention of the students,
improvement in teaching learning process, practical experience in an organizational setting,
helps them decide if the industry and the profession is the best career option to pursue,
opportunity to learn new skills and supplement knowledge, opportunity to practice
communication and teamwork skills, opportunity to learn strategies like time management,
multi-tasking etc. in an industrial setup, opportunity to meet new people and learn networking
skills, enhances their candidacy for higher education.

This internship program is an excellent opportunity to see how the theoretical aspects learned
in classes are integrated into the practical world. On-floor experience provides much more
professional experience which is often worth more than classroom teaching. This program
makes a valuable addition to the students resume.

1|Page
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. An internship may
be compensated, non-compensated or some time may be paid. The internship has to be
meaningful and mutually beneficial to the intern and the organization. It is important that the
objectives and the activities of the internship program are clearly defined and understood.
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.
• Experience gained from the ‘Industrial Internship’ will be used in classroom
discussions.
• Create conditions conducive to quest for knowledge and its applicability on the job.
• Learn to apply the Technical knowledge in real industrial situations.
• Gain experience in writing Technical reports/projects.
• Expose students to the engineer’s responsibilities and ethics.
• Familiarize with various materials, processes, products and their applications along
with relevant aspects of quality control.
• Promote academic, professional and/or personal development.
• Expose the students to future employers.
• Making students to come up with innovative solutions leading to positive impact.
• Understand the social, economic and administrative considerations that influence the
working environment of industrial organizations.
• Understand the psychology of the workers and their habits, attitudes and approach to
problem solving.

2|Page
Personality Development

Session by : Dr.T.Ravichandran, IIT Kanpur.

The course 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.
But only soft skills can ensure a person retain it, climb further, reach a pinnacle, achieve
excellence, and derive fulfilment and supreme joy.

Soft skills are non-technical skills that describe how you work and interact with others.
Unlike hard skills, they're not necessarily something you'll learn in a course, like data
analytics or programming. Instead, they reflect your communication style, work ethic, and
work style.

Soft skills comprise pleasant and appealing personality traits as self-confidence, positive
attitude, emotional intelligence, social grace, flexibility, friendliness and effective
communication skills.

Key Highlights from the Session which were gained:

 Soft skill is considered as people skills.


 Happiness quotient is determined by the person you spend maximum time with.
 Perceptional difference is the way we look at things.
 Human perceptions determine proper understanding in relationships.
 Optimistic is hopeful and confident about the future.
 Pessimist usually expects unfavourable outcomes and is suspicious when things seem
to be going.
 They tend to see the worst aspect of things or believe that worst will happen.
 Empathy the ability to understand and share the feeling of another.
 Coupled with the ability to imagine what someone else might be thinking or feeling.
 Types of empathy
1. Affective empathy
2. Somatic empathy
3. Cognitive empathy
 Steve Jobs commencement address at Stanford

3|Page
Affect of Technology on humans:

 Cyborgs is the fusion between biology and technology.


 Donna Haraway refers to the techno-humans as cyborgs. The boundary between the
man and machine are blurred.
 How to write proper email.
 Ways to get rid of bad habits .
 How humans are addicted to mobile phones.
 They have become moborgs
 Mobile phones are being used for each and everything for example for calculation,
alarm, watching movies, as watch, etc.
 They cannot imagine a life without phones.
 Learnt about cardinal principle of soft skill and personality development.
 There are 5 cardinal principles of soft skill and personality development
 Planning
 Persuasiveness
 Perseverance
 Preparedness
 Presentability

4|Page
Communication skills

A process by which information is exchanged between individuals through a common


system of symbols, signs, or behaviour.

Key Highlights from the session which were gained:

 An effective communicator will emerge as a natural leader.


 Effective communicator is the imperative goal that is the most import aspect of
developing your soft skills.
 There is difference between communicator and effective communicator.
 Effective communication is your ability to cause the intended and desired response.
 In communication process sender sends a message to the receiver through the
channel.
 Receiver gives his response in the form of feedback.
 Empathy helps you to develop into an effective communicator.
 Barriers to communication are
 Language barrier
 Technological barrier
 They are overcome by
 Making context clear
 Using nonverbal correlatives
 Seeking clarification
 Effective communication components
 Conciseness and clarity
 Conviction and confidence
 Genuineness and interest
 Empathy and timing sense
 Brevity and effectiveness

5|Page
Aptitude

The session was organised by Hilal Patel Sir from ETHNUS.

An aptitude test helps students understand the area of interest and strengths better. It provides
clarity to students on which career path is most suited based on their skill sets.

Key Highlights from the session which were gained:

 A number is a mathematical object used to count, measure, and label.


 Different types of number
a) Natural number
b) Whole number
c) Integer
d) Rational number
e) Irrational number
f) Real number
g) Complex number
 HCF: the full form of HCF in Maths is the highest common factor, which is also
known as greatest common divisor.
 HCF of two or more numbers is the greatest factor that divides the numbers.
 HCF is the product of common factors with lowest power.
 LCM is the Least Common Multiple that can be seen in two or more numbers.
 LCM is the product of all factor with highest power.

 CONCEPT OF CYCLICITY:
- Cyclicity of any number is about the last digit and how they appear in a certain
defined manner.
- The concept of cyclicity is used to identify the last digit of the number.
- Every unit digit has its own repetitive pattern when raised to any power.
- This concept is of tremendous use while solving aptitude problems.
- Example: To find the unit digit of 3^54, we divide the power by 4 because cycle
repeats itself after 4 values. Time and work-related aptitude problems were taught.
- Efficiency is inversely proportionally to time taken when the amount of work
done is constant. Percentage related aptitude problems was also explained.
- A percentage is a number or ratio that can be expressed as a fraction of 100.

6|Page
7|Page
JAVA PROGRAMMING

Java is a simple and yet powerful object oriented programming language and it is in many
respects similar to C++. Java originated at Sun Microsystems, Inc. in 1991. It was conceived
by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun
Microsystems, Inc. It was developed to provide a platform-independent programming

language .

Platform-Independent Programming Language.

Java was designed with a concept of ‘write once and run everywhere’. Unlike many other
programming languages including C and C++ when Java is compiled, it is not compiled into
platform specific machine, rather into platform independent byte code. This byte code is
distributed over the web and interpreted by virtual Machine (JVM) on whichever platform it
is being run. Java Virtual Machine plays the central role in this concept. The JVM is the
environment in which Java programs execute. It’s a software that is implemented on top of
real hardware and operating system.

Object Oriented Programming


Object Oriented Programming is a method of implementation in which programs are
organized as cooperative collection of objects, each of which represents an instance of a
class, and whose classes are all members of a hierarchy of classes united via inheritance
relationships.

Java has powerful features


The following are some of them:-

Since Java is an object oriented programming language it has following features:

 Reusability of Code
 Emphasis on data rather than procedure
 Data is hidden and cannot be accessed by external functions
 Objects can communicate with each other through functions
 New data and functions can be easily added
 Simple

8|Page
 Reusability of Code
 Portable (Platform Independent)
 Distributed
 Robust
 Secure
 High Performance
 Dynamic
 Threaded
 Interpreted

JAVA IS DISTRIBUTED
With extensive set of routines to handle TCP/IP protocols like HTTP and FTP java can open
and access the objects across net via URLs.

JAVA IS MULTITHREADED
One of the powerful aspects of the Java language is that it allows multiple threads of
execution to run concurrently within the same program. A single Java program can have
many different threads executing independently and continuously. Multiple Java applets can
run on the browser at the same time sharing the CPU time.

JAVA IS SECURE
Java was designed to allow secure execution of code across network. To make Java secure
many of the features of C and C++ were eliminated. Java does not use Pointers. Java
programs cannot access arbitrary addresses in memory.

GARBAGE COLLECTION
Automatic garbage collection is another great feature of Java with which it prevents
inadvertent corruption of memory. Similar to C++, Java has a new operator to allocate
memory on the heap for a new object. But it does not use delete operator to free the memory
as it is done in C++ to free the memory if the object is no longer needed. It is done
automatically with garbage collector.

JAVA APPLICATIONS
Java has evolved from a simple language providing interactive dynamic content for web
pages to a predominant enterprise-enabled programming language suitable for developing
significant and critical applications. Today, it is used for many types of applications including
Web based applications, financial applications, Gaming applications, embedded systems,
Distributed enterprise applications, mobile applications, Image processors, desktop
applications and many more. This site outlines the building blocks of java by stating few java
examples along with some java tutorials.

9|Page
IMPORTANT TOPICS COVERED:

 Classes & Objects


 Blueprint analogy
 Abstraction
 Encapsulation
 Point objects
 Fields
 Private fields
 The keyword this
 Syntax
 Identifiers
 Keywords
 Strings
 Escape sequences
 Static Methods and Structured Programming
 Comments
 Program Hygiene - a.ka. Style
 Algorithms
 Static methods
 for loops and nested loops
 while
 Array

10 | P a g e
Conclusion

The experiences I encountered during the internship allowed me to develop my personality,


communication skill and knowledge about java.

’Soft Skills’ is a catch-all term referring to various behaviors that help people work and
socialize well with others. In short, they are the good manners and personality traits needed to
get along with others and build positive relationships. Unlike hard skills, which include a
person’s technical skill set and ability to perform certain functional tasks, Soft Skills are
broadly applicable across job titles and industries. It’s often said that hard skills will get you
an interview but you need soft skills to get — and keep— the job.

The session on communication skills emphasised the benefits of developing and improving it.
As the ability to communicate clearly and effectively can help you connect with people, build
friendships and develop relationships at work and at home and in a range of social situations.
The training program on java focused upon increasing our knowledge and interest in and
toward the java. Because java is most interesting and most used language in these days. We
learnt the basics of the language and their implement in building up various types of
programs. It was a great experience.

Two main things that I’ve learned the importance of are time-management skills and self-
motivation. Internship is a really good program. It helps to enhance and develop our skills,
abilities, and knowledge. However, the overall experience was positive, and I'm sure I will be
able to use the skills I learned, in my career later

11 | P a g e
References

Personality development course :

https://nptel.ac.in/courses/109104107

Communication skills :

https://www.udemy.com/topic/communication-skills/free

Aptitude course :

https://www.google.com/url?sa=D&q=https://www.udemy.com/course/quantitative-aptitude-
from-scratch-to-advanced/%3F--
%3D%26utm_source%3Dadwords%26utm_medium%3Dudemyads%26utm_campaign%3D
LongTail_la.EN_cc.INDIA%26utm_content%3Ddeal4584%26utm_term%3D_._ag_1184450
32537_._ad_618853564450_._kw__._de_c_._dm__._pl__._ti_dsa-
1212271230479_._li_1007768_._pd__._%26matchtype%3D%26gclid%3DCj0KCQjwpeaYB
hDXARIsAEzItbH2DSX7V3gQquwVT7JZ04UOQbR5wFSwYy0OevPgMx-
7fcNHFktG6eoaAtyyEALw_wcB&ust=1667380440000000&usg=AOvVaw3G-
bO2Zjzt8Pefc3C7face&hl=en

12 | P a g e
Appendix

Assignment 1
(Personality Development)

1. Write a note on feelings and relationships in your family which makes you proud.
- Family is where our first and Strongest emotional memories are made, and that’s
where they keep appearing .
The most dominant feeling in a family is love, care and affection which makes us
really proud and fills confidence in us. These feelings never let us down or let us feel
lonely, sad. This is only because of the mutual understanding among the family
members.
There are many kinds of relationships among people within the family as well as
outside the family. The relationship which is truly wonderful to experience and
always creates a proud feeling is the relation between parents and children. Because
this feeling is truly pure and always contribute in development of each other. Every
success in a child’s life is the success of the efforts of their parents they have put each
and every day to make this moment wonderful and every parent’s success is
incomplete without the support from their children. Every relationship in a family and
the feelings arising from it is wonderful to experience.

2. What you would like to be after 10 years?


- After 10 years I would like to be a responsible women who would be the earing
member of a family and a passionate dancer.

3. What do you meant by ‘sense of purpose’.


- Having a sense of purpose gives us clear reasons for what we want to do. This can be
a goal in life that makes us want to study, work or train well. Closely linked with
intrinsic motivation.
Three components of a ‘sense of purpose'
- Firstly, rather than the goals of daily tasks, such as making dinner or getting to
school on time, goals related to sense of purpose are “more stable and far reaching ".
Ex:-Keeping healthy or having a successful carrier.
13 | P a g e
- Secondly, sense of purpose also has an external aim that reaches beyond the self.
This could be a drive to help others, to look after family and friends, or longing to
improve your community and work against injustice.
-Finally, purpose is driven by achievement. Getting the most out everything you do,
developing your abilities, and striving towards long term goals and a satisfying future.

4. What is Empathy ?
- It is putting yourself in someone else’s position and feeling what they are feeling.
Empathy means and that when you see another person suffering, such as after they’ve
lost a loved one, you are able to instantly envision yourself going through. The ability
to feel empathy allows people to "walk a mile in another’s shoes," so to speak. It
permits people understand the emotions that others are feeling.
Signs of Empathy :
 You arte good at picking up on hew other people are feeling.
 You often think about how other people feel.
 people often tell you about their problems.
 Other people come to you for advice.
 You often feel overwhelmed by tragic events.
 You try to help others who are suffering.
 You are good at telling when people aren’t being honest.
 You sometimes feel drained or overwhelmed in social situations.
 You care deeply about other people.
 You are good at really listening to what others have to say.
 You find it difficult to set boundaries in your relationships
- Types of Empathy:
 Affective Empathy
 Somatic Empathy
 Cognitive Empathy

14 | P a g e
5. Watch the Steve Jobs video 7 habits of life and write a brief note on it.
- Steve Jobs impact on you life cannot be overestimated. His innovations have likely
touched nearly every aspect - computer, movies, music and mobile. These are his &
habits of life:
 Do what you love - Jobs once said “People with passion can charge the world
for the better.”
 Put a dent in the universe - Jobs believed in the power of vision.
 Make connections - Jobs once said creativity is connecting things. He meant
that people with a board set of life experiences can often see things that others
miss.
 Say no 1,000 things.
 Create insanely different experiences - Jobs also sought innovation in the
customer-service experience.
 Master the message - You can have the greatest idea in the world, but if you
can’t communicate your ideas, it doesn’t matter. Job’s was the world's greatest
corporate storyteller. Instead of simply delivering a presentation like most
people do, he informed, he educated, and he entertained, all in one
presentation.
 Sell dreams, not products - Jobs captured our imagination because he reallu
understood his customer.

15 | P a g e
Assignment 2

1. Technology will surpass our human interaction. What is your thought about it?
- The "human" today is rarely divorced from technology. Technology is within medical
technologies, beside telephones, and outside satellites. Man inhabits technology when
he functions in a climate controlled office space or technology inhabits man when it
functions in him as a pacemaker. A pair of eye-glasses as a prosthetic device,
technology to be an appendage. Nevertheless, as man works in assembly line, he
appears to serve as an appendage. Technology is everywhere and in everything.
Albert Einstein says I fear the day that technology will surpass our human interaction.
The world will have a generation of idiots."

2. Write your imagination about "CYBORGS".


- Cyborgs - Cybernetic organisms - a result of a fusion between biology and
technology. Cybernetics - The study of control systems. Donna Haraway refers to the
techno-humans as cyborgs" in Simians, Cyborgs, & Women (1991). The boundaries
between man and machine are blurred. Organisms are no longer bodies of knowledge
but biotic components, a kind of information - processing device. Cyborgs are a
blending of imagination and material reality.

3. Write a note on habit and many ways to break bad habits.


- Habits play an important role in our health. Habits can arise through repetition. They
are a normal part of life, and often helpful. When behaviours become automatic, it
gives us an advantage, because the brain does not have to use conscious though to
perform the activity. Habits can also develop when good or enjoyable events trigger
the brain's "reward" centres. Understanding the biology of how we develop routines
that may be harmful to us, and how to break those routines and embrace new. Ones,
could help us change our lifestyle and adopt healthier behaviours.
- To Break Bad Habits :
 Avoid tempting situations.
 If you always stop for a donut on your way to work, try a different route.
 Replace unhealthy behaviours with healthy ones. Try exercise, a favourite
hobby or spending time with family.
16 | P a g e
 Prepare mentally - If you can't avoid a tempting situation, prepare yourself in
advance.
 Enlist support - Ask friends, family & co-workers to support your efforts to
change.
 Reward yourself for small steps. Give yourself a healthy treat when you've
achieved a small goal / milestone.

4. Have you become "moborgs"? What is comment?


- Yes, to some extent. For, many things we are so dependent on mobile ever for a
simple task. We have replaced many things by mobile. Like the alarm, calculator,
radio, books, camera etc...

5. How emails are to be written


- Email writing is an essential part of professional communication. It is not easy to get
people to respond to your emails if they do not feel interested in your message or
proposal. This is exactly the reason why you should learn to write good emails. Be
bold, get to the point right away. The best email communication is the one that is
simple and clear.
 Make sure you type in the right email ID.
 Subject line is the next most important factor you should carefully consider
because that is the first thing anyone receiving the email would see.
 Salutation or Greeting should be appropriate to receiver / s.
 The body of the email should explain the purpose of the email. However, add
only the necessary details. Keep it simple.
 End the email with a complimentary close and sign off with just your name in
informal emails and with your name and destination in a formal email.

17 | P a g e
Assignment 3

1. How would you describe good / effective Communication?


- Communication is a complex interactive process involves shared assumptions and
unspoken agreement between individuals. Effective Communication is your ability to
cause the intended and desired response. It is your ability to influence people, their
ideas and thought patterns, which govern their actions. Effective Communication will
give you sustained success in all walks of life!
- Effective Communication-components : -
 Conciseness & Clarity.
 Conviction & Confidence.
 Genuineness & interest
 Empathy & Timing Sense
 Brevity & Effectiveness

2. How important is listening in communication?


- Listening is important because
 It builds trust - when we make the effort to listen to someone, they recognize
your interest. This makes them more comfortable sharing with you and being
open.
 Listening reduces misunderstandings - When people aren't listening to each
other, it's very easy to mishear something / misinterpret someone's meaning.
 Listening helps eliminate conflict. Poor Listening skills are at the root of a lot
of conflicts. When everyone feels calm & safe, it's much easier to work
through tense situations without things escalating to conflict.
 Listening encourages empathy. When you hear right from a source, you'll
have a deeper understanding of their perspective, which is key to having
empathy.
 Listening increases your productivity - People who are good listeners are
more likely to retain information, understand what's being required of them,
& ask the right questions.

18 | P a g e
3. What are soft skills interview questions?
- Employers ask about soft skills during interview because they want to hire a candidate
who can adapt to multiple situations. Showcasing your soft skills highlights the ways
we behaved in an previous roles to achieve your goals. Employers use the STAR
(Situation, Task, Action and Result) method to assess your behaviour & see if you
skills to be successful have the right soft skills to be successful.
- Some sample questions include:
 Can you discuss a time where you had to manage your team through a
difficult situation?
 How do you prioritize your tasks when you have multiple deadlines to
meet?
4. Which barrier is the number one enemy of Communication?
- "The greatest enemy of communication - is the illusion of it.” This quote is attributed
to Pierre Martineau.
- There is potential danger in assuring (the illusion) that a message you have
communicated to another person, has been received by the person as you had
intended. This can be avoided by asking questions as necessary to ensure.

5. What are the main factors that influence interpersonal communication?


- Interpersonal communication refers to the styles and modes of communication
between individuals.
- Barriers of Interpersonal Communication:
 Emotional interference.
 Negative emotions interferences more than Positive ones.
 Attitude (threatening / domineering) makes the receiver defensive.
 He is likely to misinterpret, ignore or overreact to the messages.
 Limited frame of reference.
 Lack of Language Skills / Common knowledge.
 Use of slang, jargon.

19 | P a g e
Assignment 4

1. What is the remainder when 111 × 222 × 333 is divided by 11?


0 1 5 6

2. What is the unit's digit of the following expression,


532 × 4206 × 43 × 1267 × 38

6 8 2 4

3. What is the highest equal number of chocolates from each variety Hardik can
have if there are 88 eclairs, 280 candyman and 256 alpenliebe toffees?

8 16 4 32

4. The last digit of 8^333 is?


8 4 2 6

5. What is the remainder when 2^35 is divided by 3?


1 2 0 3

6. Find the unit’s place of the expression 1238^5672?

2 4 6 8

7. Find the unit's digit of the expression 1! + 2! + 3! +


..................+112!
2 3 6 0

8. The unit’s digit of the product 31001×722002× 13333003 is?

1 3 5 9

If N = 1!+2!+3!+. ... + 2010! then what is the digit in the unit's place
9. of N?

3 2 1 0

20 | P a g e
25 25
10. What is the remainder when 17 + 21 is divided by 19?

17 18 1 0

11. Here are 315, 420, 1155 boy of three different schools taking part in an essay
competition. What is the minimum number of rooms required such that all room
have equal number of students and each room has students of same school?

12 16 18 20

12. Find the largest four digit number, which when divided by the numbers 6, 9, 12
and 17 leaves the remainder 5, 8, 11 and 16 respectively?

9791 9781 9792 9782

13. A county cricket team has won 10 matches and lost 4. If the matches played
represent 70% of the total matches in the tournament, then how many more
matches should the team win so as to have a record of exactly 75% wins?

6 5 4 3

14. Rocket Singh is a salesman and has to choose between two schemes of remuneration.
Scheme I has a fixed salary of Rs. 3700 and a commission of 2% on sales above Rs.
50000. Scheme II has no fixed salary, but offers 3% commission on the sales up to Rs.
50000 and increases at a rate of 1 percentage point for every increase of Rs. 50000 of
sales up to a maximum of 20% of sales. What is the minimum value of the sales (in Rs.)
above which he can prefer
Scheme II?

50000 89000 140000 No such sales value exists

15. St Mary’s Public School has 30% more students than St Joseph’s Public School. If 60
students move from St Mary’s Public School to St Joseph’s Public School, the two
schools will have the same number of students. What is the total number
of students in both the schools?

600 400 800 920

21 | P a g e
16. The cost of production of a Rolex watch which is sold at 35% profit went up by 28%.
What should be the percentage increase in the selling price to maintain the
profit percentage the same even at the new cost of production?

28% 35% 63% 50%

17. In 2000, Abhilash paid a tax of 20% of his salary. In 2001, his salary increased by
33.33% and the tax scheme changed. Under the new tax scheme, he had to pay a fixed
sum of Rs. 1500 and an additional 20% on the amount above Rs. 10000. If he is paying
Rs. 100 more in taxes, under the new scheme, what is his salary
(in Rs.) in 2001?

20000 18000 14400 12000

18. The production of rice in the year 1998 was 1500 tonnes, which was 25% of the
total food grain production in that year. In the next year, if the production of rice
decreased by 4% and production of rice as a percentage of total food grain
production increased by 5 percentage points, what is the total food grain

production in1999 (in tonnes)?

4800 4200 4000 4440

19. A, B, C and D can complete the work in 20 days, 30 days, 40 days and 60 days
respectively. A and B together started the work and after 3 days C joined. After 2
more days D replaced B. After 3 more days A and C left the work. D can

complete the remaining work in how many days?

89 days 12 days 31 days 16 days

20. A and B together can do a piece of work in 12 days, B and C can do it in 16 days.
After A has been working at it for 5 days and B for 7 days, C finishes it in 13 days. In
how many days can C alone complete the work?

24 days 14 days 16 days 32 days

22 | P a g e
21. 3 men or 6 children can complete the work in 18 days. In how many days can 4 men
and 4 children complete the same work?
12 days 16 days 9 days 6 days

22. A can finish the work in 15 days, B in 20 days and C in 25 days. All these three
worked together and earned Rs.4700. Find the share of C?
Rs.2000 Rs.1500 Rs.1200 Rs.600

23. Govinda, Syed and Janak can complete a piece of work in 20, 30 and 24 days
respectively. All three of them started working and after a certain number of days(y),
Govinda stopped working and Syed stopped working exactly (y) days before the work got
completed. In how many integral numbers of days was the work completed?

12 16 14 26

24. A piece of work when done by a man, a woman and a child costs Rs.480, Rs.540 and
Rs.720 respectively. Their respective daily wages are Rs.40, Rs.30 and Rs.20. If all
the three are employed to do the work, how much would it cost to complete the work
(in Rs.)?

720 520 540 400

25. A man, a woman and a boy can do a piece of work in 6, 8 and 12 days respectively. If
a man and a woman start the work, how many boys should join
them on the second day to complete the work on the same day?

5 4 2 1

23 | P a g e
ASSIGNMENT 5

Question 1: Get strings from the command line and print to screen only the sentences those
which contain the word “Java” (with a capital ‘J’)

Solution :

package com.V_S.test;

import java.util.Scanner;

public class E_1


{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter number of
strings");
int n = sc.nextInt();
n++;
String[] str = new String[n];
System.out.println("Enter the strings");
for( int i = 0 ; i < n ; i++) {
str[i] = sc.nextLine();
}
String s = "Java";
System.out.println("The sentences which
contain 'Java' are:");
for( int i = 0 ; i < n ; i++) {
int j = str[i].indexOf(s);
if(j >= 0) {
System.out.println(str[i]);
}
}
sc.close();
}
}

24 | P a g e
OUTPUT :

Question 2: Get integers from the command, calculate the average then print to screen all the
numbers and the average.

Solution :

package com.V_S.test;

import java.util.Scanner;

public class Excercise_2


{
public static void main(String args[])
{
Scanner read = new Scanner(System.in);
System.out.println("Enter number of
integers");
int n = read.nextInt();
int[] arr = new int[n];
int sum = 0;
System.out.println("Enter the numbers ");
for(int i = 0 ; i < n ; i++)
{
arr[i] = read.nextInt();
sum = sum + arr[i];
}
float avg = (float)sum / n;
for(int i = 0 ; i < n ; i++)
{
System.out.print(arr[i] + " ");

25 | P a g e
}
System.out.println();
System.out.println("Average = " + avg);
read.close();
}
}

OUTPUT :

Question 3: Get strings from the command line, present in the console a vertical bar chart of
the frequency of each letter in the input.

 Treat small and capital letters the same – as capital


 Ignore any char that is not an English letter.

26 | P a g e
package com.V_S.test;

import java.util.Scanner;

public class Excercise_3


{
public static void main(String args[])
{
Scanner read = new Scanner(System.in);
System.out.println("Enter a string");
String str = read.nextLine();
int[] arr = new int[26];
for (int i = 0; i < 26; i++)
{
arr[i] = 0;
}
for (int i = 0; i < str.length(); i++)
{
if ((str.charAt(i) >= 'a') &&
(str.charAt(i) <= 'z'))
{
arr[str.charAt(i) - 'a']++;
} else if ((str.charAt(i) >= 'A') &&
(str.charAt(i) <= 'Z'))
{
arr[str.charAt(i) - 'A']++;
}
}
for (int i = 0; i < 26; i++)
{
if (arr[i] == 0)
{
continue;
}
char ch = (char) (i + 'A');
System.out.print(ch + "\t");
for (int j = 0; j < arr[i]; j++)
{
System.out.print("#");
}
System.out.println();
27 | P a g e
}
read.close();
}
}

OUTPUT :

28 | P a g e
Question 4: This exercise is called the Rectangles game.

Get from the command line the coordinates of two rectangles.

The “winning rectangle” is set according to these rules :

 If a rectangle is contained (even partially) in the other, the contained (=inner)


rectangle wins
 If no one contains the other, bigger by both area and perimeter wins
 If no one is bigger by both area and perimeter, we have a tie

Solution :

package com.V_S.test;

import java.util.Scanner;

public class Excercise_4


{
public static int isRectangleOverlap(int[]
a,int[] a1)
{
if((a1[0]+a1[2])>(a[0]+a[2])&&
(a1[0]>a[0]) && (a1[1]>a[1])
&&(a1[1]+a1[3])>(a[1]+a[3]))
{
return (1);
}
else if((Math.min(a[2], a1[2]) <
Math.max(a[0], a1[0]) && (Math.min(a[3], a1[3]) <
Math.max(a[1], a1[1]))))
{
return (2);
}
else
29 | P a g e
return (3);
}
public static void main(String args[])
{
int[] a = new int[4];
int[] a1 = new int[4];
double
l=0,l1=0,b=0,b1=0,ar=0,ar1=0,p=0,p1=0;
Scanner console = new Scanner(System.in);
System.out.println("Enter the coordinates
of Rectangle A: x1,y1,x2,y2");
for(int i =0; i<4; i++)
{
a[i] = console.nextInt();
}
System.out.println("Enter the coordinates
of Rectangle B: x1,y1,x2,y2");
for(int i =0; i<4; i++)
{
a1[i] = console.nextInt();
}
if(isRectangleOverlap(a,a1)==1)
{
System.out.println("The winner is
Rectangle B (contained in A!)");
}
else if(isRectangleOverlap(a,a1)==3)
{
System.out.println("The winner is
Rectangle A (contained in B!)");
}
else if(isRectangleOverlap(a,a1)==2)
{
l = Math.sqrt((Math.pow((a[2]-
a[0]),2))+(Math.pow((a[1]-a[1]),2)));
b = Math.sqrt((Math.pow((a[0]-
a[0]),2))+(Math.pow((a[3]-a[1]),2)));
ar = l*b;
p = 2*l+2*b;
l1 = Math.sqrt((Math.pow((a1[2]-
a1[0]),2))+(Math.pow((a1[1]-a1[1]),2)));
30 | P a g e
b1 = Math.sqrt((Math.pow((a1[0]-
a1[0]),2))+(Math.pow((a1[3]-a1[1]),2)));
ar1 = l1*b1;
p1 = 2*l1+2*b1;
System.out.println((ar>ar1&&p>p1)?"The
winner is Rectangle A":"The winner is Rectangle
B");
}
else if(isRectangleOverlap(a,a1)==2 &&
(ar==ar1&& p==p1))
{
System.out.println("IT's a tie");
}
}
}

OUTPUT :

31 | P a g e
ASSIGNMENT 6

Question 1 : What sequence of println statements will generate the following output ?

This program prints the first lines


of the song "slots".

"She lives in a trailer"


"On the outskirts 'a Reno"
"She plays quarter slots in the local's casino."

Solution:

package com.V_S.test;

public class Practice1


{
public static void main(String args[])
{
System.out.println("This program prints the
first lines \nof the song \"slots\".\n\n\"She
lives in a trailer\"\n\"On the outskirts 'a
Reno\"\n\"She plays quarter slots in the local's
casino.\" ");
}
}

32 | P a g e
Question 2: What sequence of println statements will generate the following output ?

A "quoted" String is
'much' better if you learn
the rules of "escape sequences."

Also, "" represents an empty String.


Don't forget to use \" instead of " !
'' is not the same as "
Solution:

package com.V_S.test;

public class Practice2


{
public static void main(String args[])
{
System.out.println("A \"quoted\" String is
\n'much' better if you learn \nthe rules of
\"escape sequences.\" \n\nAlso, \"\" represents an
empty String. \nDon't forget to use \\\" instead
of \" ! \n'' is not the same as \"");;
}
}

33 | P a g e
Question 3: What is the output of the following println statements ?

System.out.println("\ta\tb\tc");
System.out.println("\\\\");
System.out.println("'");
System.out.println("\"\"\"");
System.out.println("C:\nin\the downward spiral");

Solution:

package com.V_S.test;

public class Practice3


{
public static void main(String args[])
{
System.out.println("\ta\tb\tc");
System.out.println("\\\\");
System.out.println("'");
System.out.println("\"\"\"");
System.out.println("C:\nin\the downward
spiral");
}
}

34 | P a g e
Question 4: Write a println statement to produce this output :

/ \ // \\ /// \\\

Solution:

package com.V_S.test;

public class Practice4


{
public static void main(String args[])
{
System.out.println("/ \\ // \\\\ ///
\\\\\\");
}
}

35 | P a g e
Question 5: Write a method which returns the distance between a point and origin (0,0)

Solution:

package com.V_S.test;

import java.util.Scanner;
public class Practice5
{
public static void main(String args[])
{
int x1=0, y1=0;
double dof;
Scanner console = new Scanner(System.in);
System.out.println(" Enter x and y
coordinates");
int x2 = console.nextInt();
int y2 = console.nextInt();
dof = Math.sqrt((Math.pow((x2-x1),2)) +
(Math.pow((y2-y1),2)));
System.out.println(" The distance from
origin is : "+dof);
}
}

36 | P a g e
ASSIGNMENT 7

Question 1: Write a program to print these figures.

A. STRUCTURED WAY :

package com.V_S.test;

public class Assignment_1


{
public static void main(String args[])
{
System.out.println(" ________ ");
System.out.println(" / \\ ");
System.out.println("/ \\ ");
System.out.println("\\ / ");
System.out.println(" \\________/ ");
System.out.println();

System.out.println("\\ / ");
System.out.println(" \\________/ ");
37 | P a g e
System.out.println("+-----------+ ");
System.out.println();
System.out.println();

System.out.println(" ________ ");


System.out.println(" / \\ ");
System.out.println("/ \\ ");
System.out.println("| STOP | ");
System.out.println("\\ / ");
System.out.println(" \\________/ ");
System.out.println();
System.out.println();

System.out.println(" ________ ");


System.out.println(" / \\ ");
System.out.println("/ \\ ");
System.out.println("+-----------+ ");
}
}

OUTPUT :

38 | P a g e
B. WITHOUT REDUNDANCY :

package com.V_S.test;

public class Assignment_2


{
public static void main(String[] args)
{
egg();
Cup();
StopSignal();
hat();
}
public static void egg()
{
System.out.println(" ________ ");
System.out.println(" / \\ ");
System.out.println("/ \\ ");
System.out.println("\\ / ");
System.out.println(" \\________/ ");
System.out.println();
}
public static void Cup()
{
System.out.println("\\ / ");
System.out.println(" \\________/ ");
System.out.println("+----------+ ");
System.out.println();
System.out.println();
}
public static void StopSignal()
{
System.out.println(" ________ ");
System.out.println(" / \\ ");
System.out.println("/ \\ ");
System.out.println("| STOP | ");
System.out.println("\\ / ");
System.out.println(" \\________/ ");
System.out.println();
System.out.println();
39 | P a g e
}
public static void hat()
{

System.out.println(" ________ ");


System.out.println(" / \\ ");
System.out.println("/ \\ ");
System.out.println("+----------+ ");
}
}

OUTPUT :

40 | P a g e
C. WITH REDUNDANCY :

package com.V_S.test;

public class Assignment_3


{
public static void main(String args[])
{
egg();
Cup();
StopSignal();
hat();
}
public static void top()
{
System.out.println(" ________ ");
System.out.println(" / \\ ");
System.out.println("/ \\ ");
}
public static void bottom()
{
System.out.println("\\ / ");
System.out.println(" \\________/ ");
}
public static void egg()
{
top();
bottom();
System.out.println();
}
public static void Cup()
{
bottom();
System.out.println("+----------+ ");
System.out.println();
System.out.println();
}
public static void StopSignal()
{
top();

41 | P a g e
System.out.println("| STOP | ");
bottom();
System.out.println();
System.out.println();
}
public static void hat()
{
top();
System.out.println("+----------+ ");
}
}

OUTPUT :

42 | P a g e
ASSIGNMENT 8

Question 1: Use nested for loops to produce the following output.

Solution:

package com.V_S.test;

public class Pattern


{
public static void main(String[] args)
{
line();
topHalf();
bottomHalf();
line();
}

public static void topHalf()


{
for(int line = 1; line <=4; line++ )
{
System.out.print("|");
for(int space = 1; space <= (line*-
2+8); space++ )
43 | P a g e
{
System.out.print(" ");
}
System.out.print("<>");
for(int dot = 1; dot <= (line*4-4);
dot++ )
{
System.out.print(".");
}
System.out.print("<>");
for(int space = 1; space <= (line*-
2+8); space++ )
{
System.out.print(" ");
}
System.out.println("|");
}
}
public static void bottomHalf()
{
for(int line = 4; line >=1; line-- )
{
System.out.print("|");
for(int space = 1; space <= (line*-
2+8); space++ )
{
System.out.print(" ");
}

System.out.print("<>");
for(int dot = 1; dot <= (line*4-4);
dot++ )
{
System.out.print(".");
}
System.out.print("<>");
for(int space = 1; space <= (line*-
2+8); space++ )
{
44 | P a g e
System.out.print(" ");
}
System.out.println("|");
}
}
public static void line()
{
for(int i = 1; i >=1 ; i--)
{
System.out.print("#");
for(int j = 1; j <=16; j++)
{
System.out.print("=");
}
System.out.println("#");
}
}
}

OUTPUT :

45 | P a g e
ASSIGNMENT 9

Question 1: Create a program to produce the following ASCII art rocket with size=3.

Solution :

package com.V_S.test;

public class Rocket


{
public static void main(String args[])
{
top();
line();
topHalf();
bottomHalf();
line();
bottomHalf();
topHalf();
line();
top();
}

public static void topHalf()


{
for(int line =1; line <= 3; line++ )
{
46 | P a g e
System.out.print("|");
for(int dot = 1; dot <= (line*-1+3);
dot++ )
{
System.out.print(".");
}
for(int d = 1; d <= line; d++ )
{
System.out.print("/\\");
}
for(int dot = 1; dot <= (line*-2+6);
dot++ )
{
System.out.print(".");
}
for(int d = 1; d <= line; d++ )
{
System.out.print("/\\");
}
for(int dot = 1; dot <= (line*-1+3);
dot++ )
{
System.out.print(".");
}
System.out.println("|");
}
}
public static void bottomHalf()
{
for(int line =3; line >= 1; line-- )
{
System.out.print("|");
for(int dot = 1; dot <= (line*-1+3);
dot++ )
{
System.out.print(".");
}
for(int d = 1; d <= line; d++ )
{
System.out.print("\\/");
}
47 | P a g e
for(int dot = 1; dot <= (line*-2+6);
dot++ )
{
System.out.print(".");
}
for(int d = 1; d <= line; d++ )
{
System.out.print("\\/");
}
for(int dot = 1; dot <= (line*-1+3);
dot++ )
{
System.out.print(".");
}
System.out.println("|");
}
}
public static void line()
{
for(int i = 1; i >=1 ; i--)
{
System.out.print("+");
for(int j = 1; j <=6; j++)
{
System.out.print("=*");
}
System.out.println("+");
}
}
public static void top()
{
for(int i =1; i<=5; i++)
{
for(int j = 5; j>=i; j--)
{
System.out.print(" ");
}
for(int k =1; k<=i; k++)
{
System.out.print("/");
}
48 | P a g e
for(int l =1; l<=2; l++)
{
System.out.print("*");
}
for(int k =1; k<=i; k++)
{
System.out.print("\\");
}
for(int j = 4; j>=1; j--)
{
System.out.print(" ");
}
System.out.println();
}
}
}

OUTPUT :

49 | P a g e
Question 2: Prompt the user to enter two people’s heights inches.

-Each person should be classified as one of the following

 Short (under 5’3”)


 Medium (5’3” to 5’11”)
 Tall (6’ or over)

- The program should end by printing which person is taller.

package com.V_S.test;

import java.util.Scanner;

public class Height


{
public static void main(String[] args)
{
Scanner console = new Scanner (System.in);
System.out.println("Please Enter Height of
two people in inches:");
int h1 = console.nextInt();
int h2 = console.nextInt();
int feet1 = h1/12;
int l1 = h1%12;
int feet2 = h2/12;
int l2 = h2%12;
{
if(h1>72)
{
System.out.println("Height in feet and
inches : "+feet1+" "+l1);
System.out.println("You are tall ");

50 | P a g e
}
else if(h1>63 && h1<=71)
{
System.out.println("Height in feet and
inches : "+feet1+" "+l1);
System.out.println("You are medium ");
}
else
{
System.out.println("Height in feet and
inches : "+feet1+" "+l1);
System.out.println("You are short ");
}
}
{
if(h2>72)
{
System.out.println("Height in feet and
inches : "+feet2+" "+l2);
System.out.println("You are tall ");
}
else if(h2>63 && h2<=71)
{
System.out.println("Height in feet and
inches : "+feet2+" "+l2);
System.out.println("You are medium ");
}
else
{
System.out.println("Height in feet and
inches : "+feet2+" "+l2);
System.out.println("You are short ");
}
}
{
if ( h1 > h2 )
{
System.out.println("Person #1 is
taller than person #2 ");
}
else if(h2 > h1)
51 | P a g e
{
System.out.println("Person #2 is
taller than person #1 ");
}
else
{
System.out.println("Person #1 and
Person #2 are having same height ");
}
}
}
}

OUTPUT :

52 | P a g e
Question 3: Write a method that prints out if it is good weather to go for a bike ride. The
weather is good if the temperature is between 40 degrees and 100 degrees inclusive unless it
is raining, in which case the temperature must be between 70 degrees and 110 degrees
inclusive

package com.V_S.test;

import java.util.Scanner;
public class Ride
{
public static void main(String args[])

{
Scanner console = new Scanner(System.in);
System.out.println(" Enter the Temperature
:");
int t = console.nextInt();
if (t >40 && t <100)
{
System.out.println(" Good weather for
a bike ride");
}
else
{
System.out.println(" It's Raining");
}
}
}

OUTPUT :

53 | P a g e
Question 4: Write a method that returns the largest of three numbers using if statements.

package com.V_S.test;

import java.util.Scanner;

public class Large {

public static void main(String[] args)


{
Scanner console = new Scanner (System.in);
System.out.println("Enter 3 Numbers ");
int n1 = console.nextInt();
int n2 = console.nextInt();
int n3 = console.nextInt();
large(n1, n2, n3);
}
public static void large(int a, int b, int c)
{
if(a>b && a>c)
{
System.out.println( a +" is greatest
of the three numbers");
}
else if(b>a && b>c)
{
System.out.println( b +" is greatest
of the three numbers");
}
else
{
System.out.println( c +" is greatest
of the three numbers");
}
}
}

54 | P a g e
OUTPUT:

Question 5: Write a method that asks a user for 3 numbers and returns true if the numbers are
all distinct.

package com.V_S.test;

import java.util.Scanner;

public class Distinct


{
public static void main(String[] args)
{
int a;
a =distinct();
if(a==1)
System.out.println("Three numbers are
distinct");
else
System.out.println("Three numbers are
not distinct");
}
public static int distinct()
{
Scanner console = new Scanner (System.in);
System.out.println("Enter 3 Numbers ");
int n1 = console.nextInt();

int n2 = console.nextInt();
int n3 = console.nextInt();
if((n1 != n2) && (n1 != n3) && (n2 != n3))
55 | P a g e
return 1;
else
return 0;
}
}
OUTPUT:

Question 6: Write a method that determines if a number is a perfect number. A perfect


number equals the sum of its integer divisors, excluding itself

6 = 1 + 2 + 3, perfect

8 > 1 + 2 + 4, deficient

12 < 1 + 2 + 3 + 4 + 6, excessive

package com.V_S.test;

import java.util.Scanner;

public class Perfect


56 | P a g e
{
public static void main(String[] args)
{
perfect();
}
public static void perfect()
{
Scanner console = new Scanner (System.in);
System.out.println("Enter a number ");
int n1 = console.nextInt();
int sum = 0;
for(int i =1; i <n1; i++)
{
int n = n1%i;
if (n==0)
{
sum = sum + i;
}
}
if (sum == n1)
{
System.out.println( n1 + " is perfect
number ");
}
else
System.out.println( n1 + " is not a
perfect number ");
}
}
OUTPUT :

57 | P a g e
ASSIGNMENT 10

Question 1 : Write a method to improve checking number is prime or not

package com.V_S.test;

import java.util.Scanner;

public class Prime


{
public static void main(String[] args)
{
prime();
}
public static void prime()
{
int count = 0;
int j = 0;
Scanner console = new Scanner (System.in);
while(j!=1)
{
System.out.println("\nEnter \n1: Check
a number is Prime or not \n2: Exit");
int x = console.nextInt();
switch(x)
{
case 1:
{
System.out.println("Please Enter a
number to check if it is prime or not (or enter \"
0 \" to exit ");
int n = console.nextInt();
for(int i =2; i<n; i++)
{
if(n%i==0)
{
count++;
}
}
if(count==0)
58 | P a g e
{
System.out.println(n+" is a
prime number ");
}
else
System.out.println(n+" is a
not a prime number");
}break;
case 2:j++;break;
}
}
}
}
OUTPUT :

59 | P a g e

You might also like