I am a travel agent, I book in-city ride tickets and also ship your luggage to the next
destination.
1-NYC All Around Town it is $29.00
2-Big Bus NYC Tour it is $49.00
3-NYC one day guided Sightseeing Tour it is $89.00
4-Circle Line Complete Manhattan Island Cruise is $44.00
5-Viator VIP: Empire State Building, Statue of Liberty and 9/11 Memorial is $129.00
I also provide a quote for your shipment to be mailed to your next destination.
In order to calculate our quote, we need to know the
total weight of the shipment in pounds, the distance in miles and whether or
not there are hazardous materials in the shipment (e.g. batteries).
The calculation for the quote is as follows:
Quote = .65 * # of miles + .83 * # of pounds
If there is hazardous materials in the shipment, there is an extra cost of .20 * # of pounds
If the distance for the delivery is less than 150 miles and the total weight for
the shipment is greater than 500 pounds, then there should be a 10% discount off of the
total quote
Annotations
using System;
namespace ConsoleApplication1
{
class Ticket
{
static void Main(string[] args)
{
// Ticket cost
double[] ticket = {29,49,89,44,129};
Console.WriteLine("I am a travel agent, I book in-city ride tickets
and also ship your luggage to the next destination.");
Console.WriteLine("1-NYC All Around Town it is $29.00");
Console.WriteLine("2-Big Bus NYC Tour it is $49.00");
Console.WriteLine("3-NYC one day guided Sightseeing Tour it is
$89.00");
Console.WriteLine("4-Circle Line Complete Manhattan Island Cruise
is $44.00");
Console.WriteLine("5-Viator VIP: Empire State Building, Statue of
Liberty and 9/11 Memorial is $129.00");
// ASk to enter one and validate the choice
Console.Write("Select one: ");
int choice = Convert.ToInt32(Console.ReadLine());
while(choice<1 || choice > 5)
{
Console.Write("Select one: ");
choice = Convert.ToInt32(Console.ReadLine());
}
double ticketRate = ticket[choice - 1];
// Take input for distance, weight and hazardous materials
Console.WriteLine("\nI also provide a quote for your shipment to be
mailed to your next destination.");
Console.Write("Enter distance in miles: ");
double miles = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter weight in pounds: ");
double pounds = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Are there any hazardous materials in the
shipment (e.g. batteries)? (y/n) ");
string isHazard = Console.ReadLine();
// Calculate quote
double quote = .65 * miles + .83 * pounds;
if (isHazard.ToUpper() == "Y")
{
quote += .20 * pounds;
}
if(miles<150 && pounds > 500)
{
quote = quote - (quote * 0.10);
}
// Calculate total cost and print
double totalCost = ticketRate + quote;
Console.WriteLine("\nTotal cost:
$"+totalCost.ToString("N2"));
}
}
}
OUTPUT
Get Answers For Free
Most questions answered within 1 hours.