Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives Use decision statements Employ math methods to convert float to int Condense Boolean tests into one compound Boolean expression using logical operators 3.28 Lab
Objectives
Use decision statements
Employ math methods to convert float to int
Condense Boolean tests into one compound Boolean expression using logical operators
3.28 Lab 6b: TestLeapYean Objectives Use decision statements . Employ math methods to convert float to int Condense Boolean tests into one compound Boolean expression using logical operators Task Write a program that reads in a float value between 0.0 and 0.99999, and then displays whether it is a leap year A leap year is an integer greater than 1584 that is either divisible by 400 or is divisible by 4 but not 100. To generate a year between 1800 and 2000, use int. year - Math.round (200*x 1800);1 where x is a float value entered by the user The round ( ) method of the Math class returns the integer nearest the float passed to it. The transformation y=208x+1800 converts a number in the range 0.0 to 1 into a number in the range 1800 to 2000 Choosing test values We must check for a representative value from each of the following Test Value Year 0.345 0.55 0.9999 2000 0.0008 782 1956 Result Not a leap year Not a leap year leap year Not a leap year leap year 0 1869 even, not divisible by 4, 100, or 400 divisible by 400 divisible by 4 and 100, not 400 divisible by 4 not 100 or 400 1910 1800Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started