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

Assignment 2 CSS 105

Uploaded by

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

Assignment 2 CSS 105

Uploaded by

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

CSS 105 (Fundamentals of programming)

Assignment 2

1)Write a program to find the number of days in a month using a switch statement

2)Write a Java program that takes a year from the user and prints whether it is a leap
year or not.

3)Given two circles on the plane, find whether they have at least one common point.
The input consists of two lines. Each line contains information about one circle, namely
the coordinates of its center x and y (integers -5000 ≤ x, y ≤ 5000) and radius (integer 1
≤ r ≤ 1000).

4)If the driver is unmarried (marital variable equals 'U' or 'u'), the program prompts the
user to enter their gender and age. If the driver is male and over 30 or female and over
25, the program prints "You are Eligible for Insurance". Otherwise, the program prints
"You are Not Eligible for Insurance".
If the driver is married (marital variable equals 'M' or 'm'), the program assumes that
they are eligible for insurance and prints "You are Eligible for Insurance". If the marital
variable is neither 'M' nor 'U', the program prints "Invalid Input".

5)A little boy named John once wrote a string consisting of lowercase and uppercase
letters of the English alphabet on a sheet of paper and then went to play football. When
he returned, he discovered that his friend Mike wrote another string of the same length
under his string. Mike said that he got his string by cyclic shifting John's string to the
right by several positions. For example, the cyclic shift of the string abcde by 2 positions
to the right is deabc. However, Mike could make a mistake, so John wonders whether
Mike's claim is true. Help him! Given these two strings, output the minimum possible
shift or -1 if Mike was wrong.

You might also like