Coding Challenge: Following Day

Learn how to write nested if statements.

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 and switch statements.
  • Try to find alternative solutions. For example, one using an if/else statement, and another using a switch 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.