Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# ONLY - Below is the task and the codes that I have done. I am stuck at task 10, but would appreciate a review

C# ONLY - Below is the task and the codes that I have done. I am stuck at task 10, but would appreciate a review of the other codes

At 6 AM, the rooster will come out and make the "Cock a Doodle Doo" sound. Create a new console app and complete the following tasks:

1. State that the app will determine whether the rooster is making a "Cock a Doodle Doo" sound or not.

Code: Console.WriteLine("Does the rooster make the CockaDOodleDOo sound?";

2. Declare the variable raining to be type int:

Code: int raining;

3. Delcare the variable hour to be int:

Code: int raining;

4. Prompt the user, "Is it raining? (enter "1" for yes, it is raining):

Code: Console.WriteLine ("Is it raining? Enter '1' for for yes, it is raining");

5. Read the interger from the user and store it into the variable raining:

Code: raining = Convert.ToInt32(Console.ReadLine());

6. Prompt the user, "What is the current hour?":

Code: Console.WriteLine (" What is the current hour?");

7. Read the integer from the user and store it into the variable hour:

Code: hour = Convert.ToInt32(Console.ReadLine());

8. If the hour is less than 0, display "Invalid Hour":

Code: if (hour < 0)

{

Console.WriteLine("Invalid Hour");

}

9. If the hour is greater than or equal to 24, display "Invalid Hour":

Code: if (hour >= 24)

{

Console.WriteLine("Invalid Hour");

}

*10. If it is raining, then subtract 1 from the hour and store it into the variable hour;

Code: if (raining == 1)

{

hour = hour -1;

hour = Convert.ToInt32(Console.ReadLine());

}

11. If the hour is 6, display "Cock A Doodle Doo"

Code: if (hour == 6)

{

Console.WriteLine("Cock A Doodle Doo");

}

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

6. What actions might make employers lose elections?

Answered: 1 week ago

Question

5. Our efficiency focus eliminates free time for fresh thinking.

Answered: 1 week ago