Question: Exercise 2 You are given the following simple Java programs: Check for leap year. import java.util.Scanner; public class Demo { public static void main(String[] args)

 Exercise 2 You are given the following simple Java programs: Check

Exercise 2 You are given the following simple Java programs: Check for leap year. import java.util.Scanner; public class Demo { public static void main(String[] args) { int year; Scanner scan = new Scanner (System.in); System.out.println("Enter any Year:"); year = scan. nextInt (); scan. close(); boolean isLeap = false; if (year % 4 == 0) if( year % 100 == 0) { if ( year % 400 == 0) isLeap = true; else isLeap = false; } else isLeap = true; } else { isLeap = false; } if(isLeap==true) System. out. println (year +" is a Leap Year."); else System.out.println(year + " is not a Leap Year."); } Using input partitioning and boundary conditions, please develop functional test cases for the method. You can define your test cases as input/output pairs, as in Exercise 1. [Hint: this is functional testing, so technically you do not need to view the code. However, the provided implementation may help you design effective test cases]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!