The Whippet Bus Company charges prices for tickets based ondistance traveled, as
ID: 3618791 • Letter: T
Question
The Whippet Bus Company charges prices for tickets based ondistance traveled, as follows:
Write a program that allows a user to enter a tripdistance. The output is the ticket price
Distance (miles) Ticket Price ($) 0-99 25.00 100-299 40.00 300-499 55.00 500 and farther 70.00Explanation / Answer
Here is the c# code using System; using System.Collections.Generic; using System.Text; namespace Test { class Program { static voidMain(string[] args) { Console.WriteLine("Please enter the distance : "); int distance = Int32.Parse(Console.ReadLine()); if (distance >= 0 && distance = 100 && distance = 300 && distance = 500) { Console.WriteLine("Ticket Price = $70.00"); } else { Console.WriteLine("Invalid Distance"); } Console.ReadLine(); } } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.