Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part C-Coding (22 marks) Write a mam that will retrieve inputs from Sytem.in, as long as the input is a four digit integer bei and
Part C-Coding (22 marks) Write a mam that will retrieve inputs from Sytem.in, as long as the input is a four digit integer bei and 9999 If the input is such a valid integer, print a response string "Leap year" if the year is leap, or "Not leap year" if the year is not leap. If the input is not such a valid integer, terminate the program and print the message "Good Bye. Try again soon!". . Before doing anything else, the program should print out instructions as to what input is expected and what the program's response will be to all inputs. The program must not crash if the user provides unexpected incorrect input. A leap year is a year in which the February 29" is a valid date. A year is a leap year if it is divisible by 4. unless it is also divisible by 100 but not by 400 (in other words, years ending in 00 are only leap if they are divisible by 400) Eg 2018 is not leap, because 2018 is not divisible by 4 2020 will be a leap year, because 2020 is divisible by 4 1900 was not a leap year, because although it is divisible by 4 it is also divisible by 100 and not divisible by 400 2000 was a leap year, because although it ends in 00 2000 is divisible by 400. General marking comments: Where a block is involved, full marks are given for the correct syntax AND the correct block including alignment and indentation If block is logically wrong, subtract half the marks. If alignment or indentation is wrong, subtract 0.2 for cach. Block opening must always align with reserved word; closing can be aligned the same way, or at the end of the last statement All block content must be indented one indent from block brackets
Step 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