Question
C# You were driving a bit too fast and a police officer stops you. Develop an app that takes two inputs: your speed and whether
C#
You were driving a bit too fast and a police officer stops you. Develop an app that takes two inputs: your speed and whether it is your birthday or not. Then, the app will display wheterh you will get no ticket, a small ticket, or a big ticket. If you speed is 60 or lower, you will not get a ticket. If you speed in between 61 and 80 inclusive, you will get a small ticket. However, if you speed is 81 or above, you will get a big ticket. Also, if you are driving on your birthdy, the speed limit will be 5 more. For example, you will not get a ticket when you're driving 65 miles per hour on your birthday.
This is what I have so far:
int speed;
Console.WriteLine("How fast were you going?"); speed = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Is today your birthday?");
if (speed <= 60) { Console.WriteLine($"You will not get a ticket because you were going {speed}"); }
else if (speed <= 80 && speed >= 61) { Console.WriteLine($"You will get a small ticket because you were going {speed}"); }
else if (speed >= 81) { Console.WriteLine($"You are going to get a big ticket because your speed was {speed}"); } }
The birthday should use boolean, but I'm unclear on how to do that.
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