0% found this document useful (1 vote)
649 views2 pages

Day 1 - Programs at Bootcamp & Home

The document outlines programs to write for a bootcamp covering basic programming concepts like data types, operators, conditionals, and functions. It includes 5 programs for Day 1 at the bootcamp covering printing names, initials, and mathematical operations. It also includes 5 similar programs for homework covering checking leap years, seasons, roots of quadratic equations, distances, and sums of random dice rolls.
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 (1 vote)
649 views2 pages

Day 1 - Programs at Bootcamp & Home

The document outlines programs to write for a bootcamp covering basic programming concepts like data types, operators, conditionals, and functions. It includes 5 programs for Day 1 at the bootcamp covering printing names, initials, and mathematical operations. It also includes 5 similar programs for homework covering checking leap years, seasons, roots of quadratic equations, distances, and sums of random dice rolls.
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/ 2

Day 1 - Programs at Bootcamp -

Section A - Elements of Programing :- Basic and Built-in Data Types

1. Write a program “​PrintThreeNames.java​” that takes three names as input and


prints out a proper sentence with the names in the reverse of the order given, so
that for example, "​java PrintThreeNames Alice Bob Carol​" gives "Hi Carol, Bob,
and Alice.".
2. Write a program “​PrintInitials.java”​ that takes initials as input and prints the initials
using nine rows of asterisks like the one below.

3. Write a program to produce runtime error​ java.lang.NoSuchMethodError


4. Write a ​IntOpt.java program by taking a, b and c as input values and print the
following integer operations a + b *c, a * b + c, c + a / b, and a % b + c. Please
also understand the precedence of the operators.
5. Similarly write the ​DoubleOpt.java program by taking double value and doing the
same operations.
Day 1 - Programs at Home
Section A - Elements of Programing :- Built-in Data Types

1. Write a ​LeapYear.java program that takes a year as input and outputs the Year
is a Leap Year or not a Leap Year.
The LeapYear program only works for year >= 1582, corresponding to a year in
the Gregorian calendar. So ensure to check for the same. Further the Leap Year
is a Year divisible by 4 and not 100 unless it is divisible by 400. For e.g. 1800 is
not a Leap Year and 2000 is a Leap Year.
2. Write a program SpringSeason.java that takes two int values m and d from the
command line and prints true if day d of month m is between March 20 (m = 3, d
=20) and June 20 (m = 6, d = 20), false otherwise.
3. Write a program ​Quadratic.java to find the roots of the equation a*x*x + b*x + c.
Since the equation is x*x, hence there are 2 roots. The 2 roots of the equation
can be found using a formula
delta = b*b - 4*a*c
Root 1 of x = (-b + sqrt(delta))/(2*a)
Root 2 of x = (-b - sqrt(delta))/(2*a)
Take a, b and c as input values to find the roots of x.
4. Write a program ​Distance.java that takes two integer command-line arguments x
and y and prints the Euclidean distance from the point (x, y) to the origin (0, 0). The
formulae to calculate distance = sqrt(x*x + y*y). Use Math.power function
5. Write a program ​SumOfTwoDice.java that prints the sum of two random integers
between 1 and 6 (such as you might get when rolling dice).

You might also like