Answer to Question #247633 in C# for codeman321

Question #247633

Write a program that recommends whether you should bring an umbrella to school. Your program should ask the user to enter the probability for rain in today’s weather forecast. If the probability is greater than 30% then output “Bring your umbrella today”. Otherwise, output “Leave your umbrella at home today”. Test your program using the values 50 and 20. 


1
Expert's answer
2021-10-06T16:09:03-0400
using System;


namespace App
{
    class Program
    {
        static void Main(string[] args){
            //ask the user to enter the probability for rain in today’s weather forecast. 
            Console.Write("Enter the probability for rain in today's weather forecast: ");
            int probability = int.Parse(Console.ReadLine());
            //If the probability is greater than 30% then output "Bring your umbrella today". 
            if (probability > 30)
            {
                Console.WriteLine("Bring your umbrella today.");
            }
            else
            {
                //Otherwise, output "Leave your umbrella at home today". 
                Console.WriteLine("Leave your umbrella at home today.");
            }
            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS