Question
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
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