Question

In: Computer Science

I am a travel agent, I book in-city ride tickets and also ship your luggage to...

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. Create a c# console app using conditional statement

Solutions

Expert Solution

IDE used: Online compiler onlinegdb.com

Program

using System;
public class TravelAgency {
public static void Main() {
  
  
//variables for weight, distance, quote, discount
   double weight,distance,quote,discount;
  
   //string to get if hazardous material or not
   string hazard;
  
//get distance and weight
   Console.WriteLine("\nEnter total Distance: ");
distance=Convert.ToDouble(Console.ReadLine());
  
  
   Console.WriteLine("\nEnter total weight: ");
weight=Convert.ToDouble(Console.ReadLine());
  
  
//ask if any hazardous material
   Console.WriteLine("\nIf any hazardous material? (yes/no) :");
hazard=Console.ReadLine();
  
//if hazardous material get extra charge
   if(string.Compare(hazard,"yes")==0)
{
quote=(0.65*distance)+(0.83*weight)+(0.20*weight);

   //check if distance less than 150 and weight more than 500 give discount
   if(distance<150.00 && weight>500.00)
{
Console.WriteLine("\nSince distance is less than 150 and weight is more than 500 there is 10% discount ");

       //calculate discount
       discount=0.1*quote;
Console.WriteLine("\nDiscount is : "+string.Format("{0:.##}",discount)+ "dollars");  //string.format : two place decimal

       //calculate final quote and print
       quote=quote-discount;
Console.WriteLine("\nYour total quote is : " +string.Format("{0:.##}",quote)+ " dollars");
}
else
{
Console.WriteLine("Your total quote is : " +string.Format("{0:.##}",quote)+ " dollars");
}
}
  
   //if no hazardous material
else
{
quote=(0.65*distance)+(0.83*weight);
if(distance<150.00 && weight>500.00)
{
discount=0.1*quote;
quote=quote-discount;
Console.WriteLine("Your total quote is : " +string.Format("{0:.##}",quote)+ " dollars");
}
else
{
Console.WriteLine("Your total quote is : " +string.Format("{0:.##}",quote)+ " dollars");
}
}
  
}
}

Sample Output



Related Solutions

.Suppose I am in a boat and I travel at the bearing N70E at 30 knots...
.Suppose I am in a boat and I travel at the bearing N70E at 30 knots for 4 hours. Then, I turn 90 degrees clockwise and travel for 5 hours at the same speed. Find my bearing relative to the dock.
Your local travel agent is advertising an upscale winter vacation package for travel three years from...
Your local travel agent is advertising an upscale winter vacation package for travel three years from now to Antarctica. The package requires that you pay $15944 today, $12933 one year from today, and a final payment of $24039 on the day you depart three years from today. What is the cost of this vacation in today's dollars if the discount rate is 4 %? (Round answer to 2 decimal places. Do not round intermediate calculations).
List 5 benefits (values) of using a travel agent, rather than booking your own travel.
List 5 benefits (values) of using a travel agent, rather than booking your own travel.
This is in Python I am getting an error when I run this program, also I...
This is in Python I am getting an error when I run this program, also I cannot get any output. Please help! #Input Section def main(): name=input("Please enter the customer's name:") age=int(input("Enter age of the customer: ")) number_of_traffic_violations=int(input("Enter the number of traffic violations: ")) if age <=15 and age >= 105: print('Invalid Entry') if number_of_traffic_violations <0: print('Invalid Entry') #Poccessing Section def Insurance(): if age < 25 and number_of_tickets >= 4 and riskCode == 1: insurancePrice = 480 elif age >=...
I am in a spaceship traveling to Mars at 500000m/s. My ship has a red light...
I am in a spaceship traveling to Mars at 500000m/s. My ship has a red light on the front of it with a wavelength of 750nm. What frequency does an observer on Mars think my light appears to be? Towards what color range/light range is that shift? Does it get shifted towards higher frequency or lower frequency?
Travel Inc. sells tickets for a Caribbean cruise to Carmel Company employees. The total cruise package costs Carmel $70,000 from Ship A way Cruise liner.
Travel Inc. sells tickets for a Caribbean cruise to Carmel Company employees. The total cruise package costs Carmel $70,000 from Ship A way Cruise liner. Travel Inc. receives a commission of 6% of the total price. Travel Inc., therefore, remits $65,800 to Ship A way. Prepare the entry to record the revenue recognized by Travel Inc. on this transaction.
I am using IntelliJ IDEA with JavaFX to build a travel expensive calculator, but somehow it...
I am using IntelliJ IDEA with JavaFX to build a travel expensive calculator, but somehow it wouldn't calculate total expensive? It was working until I add the TextFieldListener because I need to make sure user only input either mile driven or airfareCost. Please help me figure out what I did wrong. import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import...
how do I make a histogram. I am using the example from the book Essentials of...
how do I make a histogram. I am using the example from the book Essentials of Statistics Chapter 2.2, Problem 9BSC.
Your friend, Sam had a rental property rented to a travel agent The property used to...
Your friend, Sam had a rental property rented to a travel agent The property used to generate rental revenues of $100000 per annum. Due to COVID19, the travel agent shut down the business and moved out of the property. Instead of renting it again to a new tenant, Sam is planning for an investment opportunity. He plans to use the property for producing toilet tissues and hand sanitizer to take advantage of recently increased demand for these products in the...
Your friend, Sam had a rental property rented to a travel agent The property used to...
Your friend, Sam had a rental property rented to a travel agent The property used to generate rental revenues of $100000 per annum. Due to COVID19, the travel agent shut down the business and moved out of the property. Instead of renting it again to a new tenant, Sam is planning for an investment opportunity. He plans to use the property for producing toilet tissues and hand sanitizer to take advantage of recently increased demand for these products in the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT