Coding Challenge: Following Day
Learn how to write nested if statements.
We'll cover the following
Here are a few pieces of advice about these exercises:
- Keep on choosing your variable names wisely, and respect indentation when creating code blocks associated with
if/else
andswitch
statements. - Try to find alternative solutions. For example, one using an
if/else
statement, and another using aswitch
statement. - Test your programs thoroughly, without the fear of finding mistakes. It’s a very important skill.
Problem statement
Write a program that accepts a day name from the user in the variable, then shows the name of the following day. Incorrect inputs must be taken into account.
Input
Enter day: Monday
Expected output
Following day: Tuesday
Coding exercise
Get hands-on with 1400+ tech skills courses.