Answer to Question #247874 in C# for loganprog

Question #247874

You are going to the Rogers Centre to watch a baseball game. The aroma from

a hot dog cart catches your attention. Hot dogs are $2.50 each. Write a program

that asks you how much change you have in your pocket. If you have enough to

buy a hot output “Grab a hot dog.” In either case, output “Enjoy the game!” Test

your program using the values $2.00 and $3.00.


1
Expert's answer
2021-10-07T10:06:51-0400
using System;


namespace App
{
    class Program
    {
        static void Main(string[] args){
            //asks you how much change you have in your pocket. If you have enough to
            //buy a hot output "Grab a hot dog." In either case, output "Enjoy the game!" 
            Console.Write("How much change you have in your pocket? ");
            double change = double.Parse(Console.ReadLine());
            if (change >=2.5)
            {
                Console.WriteLine("Grab a hot dog");
            }
            else
            {


                Console.WriteLine("Enjoy the game!");
            }
            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
APPROVED BY CLIENTS