Question

In: Computer Science

Write a C++ program to choose one of the following five options for your summer vacation...

  1. Write a C++ program to choose one of the following five options for your summer vacation
  1. Hawaii
  2. Bahamas
  3. Cancun
  4. Las Vegas
  5. Europe

Your program should select one of the above option. Once the option is selected then your program should select one of the following airlines:

  1. US Air
  2. Delta
  3. Southwest
  4. Continental
  5. American Airline

Once the airline is selected then read number of passengers airfare for round trip. Calculate the total charge.

make your own charges

Solutions

Expert Solution

Below is the solution:

#include <iostream>
using namespace std;

int main() {
   string summerVacation,airlines;
   int vacationOption,airlinesOption,noOfPassengers;
   float flightcharge,km;
   cout<<"1. Hawaii\n2. Bahamas\n3. Cancun Las\n4. Vegas Europe\n";
   cout<<"Enter an option for summer vacation type:";
   cin>>vacationOption; //accept the input of vaction type
   switch(vacationOption){
       case 1: summerVacation = "Hawaii";
               km=200;
               break;
              
       case 2: summerVacation = "Bahamas";
               km=243;
               break;
              
       case 3: summerVacation = "Cancun Las";
               km=300;
               break;
              
       case 4: summerVacation = "Vegas Europe";
               km=570;
               break;
              
       default: summerVacation = "invalid vacation choice";
               km=0;
               break;
   }
  
   cout<<"\n1. US Air\n2. Delta\n3. Southwest\n4. Continental\n4. American Airline\n";
   cout<<"Enter an option for Airlines type:";
   cin>>airlinesOption; //accept the input of airlines type
    switch(airlinesOption){
       case 1: airlines = "US Air";
               flightcharge = 2; //per kilometer
               break;
              
       case 2: airlines = "Delta";
               flightcharge = 2.5; //per kilometer
               break;
              
       case 3: airlines = "Southwest";
               flightcharge = 2.1; //per kilometer
               break;
              
       case 4: airlines = "Continental";
               flightcharge = 3.3; //per kilometer
               break;
              
       case 5: airlines = "American Airline";
               flightcharge = 4.1; //per kilometer
               break;      
              
       default: airlines = "invalid airlines choice";
               flightcharge = 0; //per kilometer
               break;
   }
   cout<<"\nEnter the number of passengers airfare for round trip:";
    cin>>noOfPassengers; //accept the no of passenger to travel
  
    float totalFare = (flightcharge*km)*noOfPassengers; //calculate the flight charge by flight fare * kilometer travel * no of passenger
    //display the info and flight charge total
    cout<<"\nSummer Vacation is: "<<summerVacation<<endl;
    cout<<"Airlines is: "<<airlines<<endl;
    cout<<"Total fare is: "<<totalFare<<endl;
  

   return 0;
}

sample output:

1. Hawaii
2. Bahamas
3. Cancun Las
4. Vegas Europe
Enter an option for summer vacation type: 2
1. US Air
2. Delta
3. Southwest
4. Continental
4. American Airline
Enter an option for Airlines type: 2
Enter the number of passengers airfare for round trip: 4
Summer Vacation is: Bahamas
Airlines is: Delta
Total fare is: 2430

If found the solution helpful please upvote.


Related Solutions

3. Write a C++ program to choose one of the following five options for your summer...
3. Write a C++ program to choose one of the following five options for your summer vacation 1. Hawaii 2. Bahamas 3. Cancun 4. Las Vegas 5. Europe Your program should select one of the above option. Once the option is selected then your program should select one of the following airlines: 1. US Air 2. Delta 3. Southwest 4. Continental 5. American Airline Once the airline is selected then read number of passengers airfare for round trip. Calculate the...
write a complete C++ program that allows the user to choose from one of several options....
write a complete C++ program that allows the user to choose from one of several options. The program will display a menu and each option will be in a separate function. The program will continue looping until the user chooses to quit. The module descriptions are given below. a. Prompt for and take as input 3 floating point values (l, w, and h). The program will then calculate the volume (volume = l*h*w ). The program should then output to...
Write a java program that will first display the following menu: Choose one of the following...
Write a java program that will first display the following menu: Choose one of the following 1- To add 2 double integers 2- To add 2 integer numbers 3- To add 3 double numbers 4- To add 3 integer numbers After reading user’s choice, use a switch case statement to call the corresponding method Void add 1 (double n1, double n2) Void add2() Double add3 (double n1, double n2, double n3) Double add4 ()
write a program to perform the following in C Your program should prompt the user to...
write a program to perform the following in C Your program should prompt the user to enter ten words, one at a time, which are to be stored in an array of strings. After all of the words have been entered, the list is to be reordered as necessary to place the words into alphabetical order, regardless of case. Once the list is in alphabetical order, the list should be output to the console in order. The program should execute...
In C program #include<stdio.h> You found an exciting summer job for five weeks. Suppose that the...
In C program #include<stdio.h> You found an exciting summer job for five weeks. Suppose that the total tax you pay on your summer job income is 14%. After paying the taxes, you spend: You spend 10% of your net income to buy new clothes and other accessories for the next school year You 1% to buy school supplies AFTER buying clothes and school supplies, you save 25% of the remaining money For each dollar you save, your parents add $0.50...
For your first project, write a C program (not a C++ program!)that will read in a...
For your first project, write a C program (not a C++ program!)that will read in a given list of non-negative integers and a target integer and checks if there exist two integers in the list that sum up to the target integer. Example:List: 31, 5, 8, 28, 15, 21, 11, 2 Target: 26 Yes!, 44 No! your C program will contain the following: •Write a function that will make a copy of the values from one array to another array....
Please write program in C++ format: Write a program to accept five negative numbers from the...
Please write program in C++ format: Write a program to accept five negative numbers from the user. (1) Find the average of the five numbers and display the answer to the standard output. Keep the answer two decimal points - 5 points (2) Output the numbers in ascending order and display the answer to the standard output. - 5 points
I need to write a program in C with the following specification * ​​​​​​​Line one of...
I need to write a program in C with the following specification * ​​​​​​​Line one of the standard input will have the total number of people which must not be greater than 10 * Each of the subsequent lines of input will be the first name of a person and their number (ex. "Adam 85") one space between name and number * Each name must be a maximum of 14 characters * Put the first names into an array called...
in java Write a Java Program that displays a menu with five different options: 1. Lab...
in java Write a Java Program that displays a menu with five different options: 1. Lab Test Average Calculator 2. Dice Roll 3. Circle Area Calculator 4. Compute Distance 5. Quit The program will display a menu with each of the options above, and then ask the user to enter their choice. There is also a fifth option to quit, in which case, the program will simply display a goodbye message. Based on the user’s choice, one of the options...
Write a menu program to have the above options for the polynomials. Your menu program should...
Write a menu program to have the above options for the polynomials. Your menu program should not use global data; data should be allowed to be read in and stored dynamically. Test your output with the data below. Poly #1: {{2, 1/1}, {1, 3/4}, {0, 5/12}} Poly #2: {{4, 1/1}, {2, -3/7}, {1, 4/9}, {0, 2/11}} provide a C code (only C please) that gives the output below: ************************************ *         Menu HW #4 * * POLYNOMIAL OPERATIONS * * 1....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT