Assignment 2 - Decision - 1
Assignment 2 - Decision - 1
com
Programming Assignment #2
Decisions
1- Leap Year
A year with 366 days is called a leap year. A year is a leap year if it is divisible by 4 (for example,
the year 1980), except it is not a leap year if it is divisible by 100 (for example, the year 1900);
however, it is a leap year if it is divisible by 400 (for example, the year 2000).
There were no exceptions before the introduction of the Gregorian calendar on October 15, 1582
(for example, the year 1500 was a leap year). Write a program that asks the user for a year and
computes whether that year is a leap year or not.
Page 1
2- Calculator
Write a Java program that designs a calculator. The program should read from the user two
integer numbers and a character which indicates the type of operation desired.
3- Salary
Complete the following program to determine the raise and new salary for an employee by adding
if -else statements to compute the raise. The input to program includes the current annual salary
for the employee and a number indicating the performance rating (1=excellent, 2=good, and
3=poor). An employee with a rating of 1 will receive a 6% raise, an employee with a rating of 2
will receive a 4% raise, and one with a rating of 3 will receive a 1.5% raise.
Write a program that reads in three floating-point numbers and sorts them. For example
5- Min-Max
How can you find the minimum/maximum of three numbers using the conditional operator, in
just one line?
Page 2