Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Good day! Bonjour! Good evening! Bonsoir! You are in a bilingual country! A nice thing to know is how to greet people in any language.

Good day! Bonjour! Good evening! Bonsoir!

You are in a bilingual country! A nice thing to know is how to greet people in any language. You are going to write a program to make sure that we know how to greet the people around us. The French word Bonjour means "Good day". This is greeting can be used from morning until dusk (lets 18:00 or 6pm). After dusk we might say Bonsoir or "Good evening". Lets make a program that lets us know what is most appropriate to say based on the time of day. We will use the 24-hour clock (which runs from 0:00 to 23:59) to make it easier.

If the time is before 17:00, we will output

Good day! Bonjour! 

Otherwise, the program will output

Good evening! Bonsoir! 

Details of your program are defined below. Hint: We learned about if/else statements in class this week!

Details

Input

The program takes in the following input:

hour: an integer, from 0 to 23, representing the hour of the day (in 24-hour time)

minutes: an integer representing the minutes after that hour (from 0 to 59)

(You will notice that the program already outputs this time so that you can see more details about the test cases.)

Processing

Check whether the time is before or after 17:00.

Output

If the time is before 17:00, the program will output "Good day!" on one line, followed by Bonjour! on the next.

Otherwise, the program will output Good evening on one line followed Bonsoir!

Sample input/output:

Input Output
7:15 7:15 Good day! Bonjour!
13:43 13:43 Good day! Bonjour!
19:57 19:57 Good evening! Bonsoir!
23:56 23:56 Good evening! Bonsoir!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions