Question

Create a program in Visual studio c++ Frank wants to take his wife, son, and daughter...

Create a program in Visual studio c++

Frank wants to take his wife, son, and daughter on a vacation this next summer.

Create a program named "Your last name_Vacation" This program will prompt Frank to choose a number between 1 and 6.

Use a switch…case to determine which number he chose.

Use a Do…while loop to return to the prompt if the number is <1 and >6. 1 - Hawaii – 7 days / 6 nights 2 - New York – 3 days / 2 nights 3 - London – 7 days / 6 nights 4 - Bahamas – 7 days / 6 nights 5 - Miami – 3 days / 2 nights 6 - Los Angeles – 3 days / 2 nights

The default will be; Stay Home – 7 days / 6 nights Use a Do…while loop to return to the prompt if the number is <1 and >6.

Create a message that tells Frank about his vacation he chose. Use a for loop to create a list when Frank enters his first name, last name, and age, then enters the same for his wife, son, and daughter. Ex. Frank Last Age Wife “ “ Son “ “ Daughter “ “ Frank will input the departure date of his vacation.

The final output should be in the following format; Congratulations! You and your family are going to “location” Frank Last Age Wife “ “ Son “ “ Daughter “ “ Your departure date is “date”

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;


int main() {

int num;
string firstName[4],lastName[4];
int age[4];
string location,departureDate;
do
{
   cout<<"\nEnter the location number : ";
   cin>>num;
  
   switch(num)
   {
       case 1: location = "Hawaii – 7 days / 6 nights";
               break;
       case 2: location = "New York – 3 days / 2 nights";
               break;
       case 3: location = "London – 7 days / 6 nights";
               break;
       case 4: location = "Bahamas – 7 days / 6 nights";
               break;
       case 5: location = "Miami – 3 days / 2 nights";
               break;
       case 6: location = "Los Angeles – 3 days / 2 nights";
               break;
      
       default: location = "Stay Home – 7 days / 6 nights";
               break;
   }
  
}while(num < 1 || num > 6);


for(int i = 0;i<4;i++)
{
   cout<<"\nEnter first name of member : ";
   cin>>firstName[i];
   cout<<"\nEnter last name of member : ";
   cin>>lastName[i];
   cout<<"\nEnter age : ";
   cin>>age[i];
}

cout<<"\nEnter the departure date : ";
cin>>departureDate;

if(num >= 1 && num <= 6)
cout<<"\nCongratulations! You and your family are going to "<<location<<" "<<firstName[0]<<" "<<lastName[0]<<" "<<age[0] <<" "<<firstName[1]<<" "<<lastName[1]<<" "<<age[1]<<" "<< firstName[2]<<" "<<lastName[2]<<" "<<age[2] <<" "<< firstName[3]<<" "<<lastName[3]<<" "<<age[3]<<" Your departure date is "<<departureDate;

   return 0;
}

Output:

Enter the location number : 8
Enter the location number : 3
Enter first name of member : Frank
Enter last name of member : Jones
Enter age : 45
Enter first name of member : Cathy
Enter last name of member : Jones
Enter age : 42
Enter first name of member : Nick
Enter last name of member : Jones
Enter age : 8
Enter first name of member : Annie
Enter last name of member : Jones
Enter age : 6
Enter the departure date : 5-Feb-2020
Congratulations! You and your family are going to London – 7 days / 6 nights Frank Jones 45 Cathy Jones 42 Nick Jones 8 Annie Jones 6 Your departure date is 5-Feb-2020

Do ask if any doubt. Please up-vote.

Add a comment
Know the answer?
Add Answer to:
Create a program in Visual studio c++ Frank wants to take his wife, son, and daughter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • THIS MUST BE DONE ON VISUAL STUDIO Write a C# program that computes a the cost...

    THIS MUST BE DONE ON VISUAL STUDIO Write a C# program that computes a the cost of donuts at your local Rich Horton’s store. The cost, of course, depends on the number of donuts you purchase. The following table gives the break down: Donuts Purchased Cost per Donut ($) = 15 0.75 A customer can save on the HST (13%) if they buy 12 or more donuts so only charge HST (use a constant) on the purchase if the customer...

  • Create a program using Visual Studio 2017 called dataExercise.c that declares the following variables and displays...

    Create a program using Visual Studio 2017 called dataExercise.c that declares the following variables and displays their values: 1. Declare a character variable with value 'a', and display the character using printf with a %c format. Then add a second printf that displays the character with a %d format. 2. Declare a short int variable with a value set to the maximum value of a short int (the maximum value for whatever machine I happen to use to grade your...

  • Please answer in Visual Studio 2019 c# format. Not python. Thank you. Q. Write a program...

    Please answer in Visual Studio 2019 c# format. Not python. Thank you. Q. Write a program that works as described in the following scenario: The user enters a credit card number. The program displays whether the credit card number is valid or invalid. Here are two sample runs: Enter a credit card number as a long integer: 4388576018410707 4388576018410707 is valid Enter a credit card number as a long integer: 4388576018402626 4388576018402626 is invalid To check the validity of the...

  • This C++ Program should be written in visual studio 2017 You are to write a program...

    This C++ Program should be written in visual studio 2017 You are to write a program that can do two things: it will help users see how long it will take to achieve a certain investment goal given an annual investment amount and an annual rate of return; also, it will help them see how long it will take to pay off a loan given a principal amount, an annual payment amount and an annual interest rate. When the user...

  • Your mission in this programming assignment is to create a Python program that will take an...

    Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents.   Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...

  • This C++ Programs should be written in Visual studio 2017 PROGRAM 1: Comparing Using Arrays to...

    This C++ Programs should be written in Visual studio 2017 PROGRAM 1: Comparing Using Arrays to Using Individual Variables One of the main advantages of using arrays instead of individual variables to store values is that the program code becomes much smaller. Write two versions of a program, one using arrays to hold the input values, and one using individual variables to hold the input values. The programs should ask the user to enter 10 integer values, and then it...

  • I need help with a C++ assignment: Write a program containing the following: 1. Variable Definitions...

    I need help with a C++ assignment: Write a program containing the following: 1. Variable Definitions only as (DieRoll, Guess, cnt1, cnt2) followed by this statement: srand((unsigned int)time (NULL)); which will give the random number generator a random starting point. Note: srand and rand require the TIME.H (or iomanip) cnt1 and cnt2 will be used in Chapter 5 drop box as counters for loops. Do NOT create additional variables. Points will be taken off for any additional variable creation. 2....

  • C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your...

    C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your input will be the smallest number of inches and the largest number of inches to be converted. The intervals will be in 6 inch increments. One inch is equivalent to 2.54 centimeters. Include the following in your program: 1. Include an initial algorithm that outlines your steps. 2. Include a refined algorithm that details how each step will be executed. 3. Prompt the User...

  • TASK: C programming Create a program in either visual Studios or an online compiler that will...

    TASK: C programming Create a program in either visual Studios or an online compiler that will use the modern lift equation to calculate the average litt force of input values provided below. The modern lift formular L-a" I. - lift in Newtons air density in kg/m3 V = velocity in m/s 4 - Wing area in m CL = 2 x Pl x angel of the wing This formula is used to calculate the lift produced by airplane wings. You...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT