Java Report
Java Report
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
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
1 Introduction
1.1Introduction 1
1.2Objectives 2
2 Personality Development 3
3 Communication skills 5
4 Aptitude 6
6 Conclusion 11
7 References 12
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:
2|Page
Personality Development
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.
3|Page
Affect of Technology on humans:
4|Page
Communication skills
5|Page
Aptitude
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.
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 .
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.
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:
10 | P a g e
Conclusion
’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
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.
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."
17 | P a g e
Assignment 3
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.
19 | P a g e
Assignment 4
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
2 4 6 8
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?
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?
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?
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?
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?
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
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
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?
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.)?
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;
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;
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.
26 | P a g e
package com.V_S.test;
import java.util.Scanner;
OUTPUT :
28 | P a g e
Question 4: This exercise is called the Rectangles game.
Solution :
package com.V_S.test;
import java.util.Scanner;
OUTPUT :
31 | P a g e
ASSIGNMENT 6
Question 1 : What sequence of println statements will generate the following output ?
Solution:
package com.V_S.test;
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."
package com.V_S.test;
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;
34 | P a g e
Question 4: Write a println statement to produce this output :
/ \ // \\ /// \\\
Solution:
package com.V_S.test;
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
A. STRUCTURED WAY :
package com.V_S.test;
System.out.println("\\ / ");
System.out.println(" \\________/ ");
37 | P a g e
System.out.println("+-----------+ ");
System.out.println();
System.out.println();
OUTPUT :
38 | P a g e
B. WITHOUT REDUNDANCY :
package com.V_S.test;
OUTPUT :
40 | P a g e
C. WITH REDUNDANCY :
package com.V_S.test;
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
Solution:
package com.V_S.test;
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;
OUTPUT :
49 | P a g e
Question 2: Prompt the user to enter two people’s heights inches.
package com.V_S.test;
import java.util.Scanner;
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;
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;
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:
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;
57 | P a g e
ASSIGNMENT 10
package com.V_S.test;
import java.util.Scanner;
59 | P a g e