Question

In: Computer Science

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”.

Solutions

Expert Solution

Program:

#include<iostream>

using namespace std;

int main()
{
int n;
string location;
string fname[4], lname[4];
int age[4], m, d, y;
char ch;

do
{
cout<<"Enter a number between 1 and 6: ";
cin>>n;
if(n>=1 && n<6)
break;
cout<<"Try again!";
}while(1);

cout<<"Frank! vacation you chose:"<<endl;

switch(n)
{
case 1:
location = "Hawaii – 7 days / 6 nights";
cout<<location<<endl;
break;
case 2:
location = "New York - 3 days / 2 nights";
cout<<location<<endl;
break;
case 3:
location = "London - 7 days / 6 nights";
cout<<location<<endl;
break;
case 4:
location = "Bahamas - 7 days / 6 nights";
cout<<location<<endl;
break;
case 5:
location = "Miami - 3 days / 2 nights";
cout<<location<<endl;
break;
case 6:
location = "Los Angeles - 3 days / 2 nights";
cout<<location<<endl;
break;
default:
location = "Stay Home - 7 days / 6 nights";
cout<<location<<endl;
}

cout<<"Enter first name, last name, and age of yours, wife, son, and daughter: "<<endl;
for(int i=0; i<4; i++)
{
cout<<"Enter first name:";
cin>>fname[i];
cout<<"Enter last name:";
cin>>lname[i];
cout<<"Enter age: ";
cin>>age[i];
}

cout<<"Enter the departure date of vacation: (MM-DD-YYYY)";
cin>>m>>ch>>d>>ch>>y;

cout<<"Congratulations! You and your family are going to "<<location<<endl;
cout<<fname[0]<<" "<<lname[0]<<" Age: "<<age[0]<<endl;
cout<<"Wife "<<fname[1]<<" "<<lname[1]<<" Age: "<<age[1]<<endl;
cout<<"Son: "<<fname[2]<<" "<<lname[2]<<" Age: "<<age[2]<<endl;
cout<<"Daughter: "<<fname[3]<<" "<<lname[3]<<" Age: "<<age[3]<<endl;
cout<<"Your departure date is "<<m<<ch<<d<<ch<<y<<endl;
  
return 0;
}

Output:


Related Solutions

IN JAVA Frank wants to take his wife, son, and daughter on a vacation next summer....
IN JAVA Frank wants to take his wife, son, and daughter on a vacation next summer. This program will prompt Frank to choose a number between 1 and 6. Use a switch…case to determine which number he chose.                         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                          ...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a whole paragraph with punctuations (up to 500 letters) either input from user, initialize or read from file and provide following functionalities within a class: a)   Declare class Paragraph_Analysis b)   Member Function: SearchWord (to search for a particular word) c)   Member Function: SearchLetter (to search for a particular letter) d)   Member Function: WordCount (to count total words) e)   Member Function: LetterCount (ONLY to count all...
In visual Studio C++ Create a program that uses a for loop to input the high...
In visual Studio C++ Create a program that uses a for loop to input the high temperature, and low temperature for each day of the week. The high and low will be placed into two elements of the array. For each loop the high and low will be placed into the next set of elements of the array. After the temps for all seven days have been entered into the array, a for loop will be used to pull out...
create a C++ program using Visual Studio that could be used by a college to track...
create a C++ program using Visual Studio that could be used by a college to track its courses. In this program, create a CollegeCourse class includes fields representing department, course number, credit hours, and tuition. Create a child (sub class) class named LabCourse, that inherits all fields from the the CollegeCourse class, includes one more field that holds a lab fee charged in addition to the tuition. Create appropriate functions for these classes, and write a main() function that instantiates...
Create a Visual Studio console project (c++) containing a main() program that declares a const int...
Create a Visual Studio console project (c++) containing a main() program that declares a const int NUM_VALUES denoting the array size. Then declare an int array with NUM_VALUES entries. Using a for loop, prompt for the values that are stored in the array as follows: "Enter NUM_VALUES integers separated by blanks:" , where NUM_VALUES is replaced with the array size. Then use another for loop to print the array entries in reverse order separated by blanks on a single line...
C++ Visual Studio 2019 Part A : Program Description: Write a program to generate a report...
C++ Visual Studio 2019 Part A : Program Description: Write a program to generate a report based on input received from a text file. Suppose the input text file student_grades.txt contains the student’s Last name , First name, SSN, Test1, Test2, Test3 and Test4. (25%) i.e. Alfalfa   Aloysius   123-45-6789 40.0    90.0   100.0    83.0 Generate the output Report File student_final.txt in the following format : LastName FirstName   SSN Test1   Test2   Test3   Test4 Average FinalGrade i.e. Alfalfa   Aloysius   123-45-6789 40.0    90.0   100.0   ...
answer the following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this part of the assignment, you are required to create a C# Console Application project. The project name should be A3<FirstName><LastName>P2. For example, a student with first name John and Last name Smith would name the project A1JohnSmithP2. Write a C# (console) program to calculate the number of shipping labels that can be printed on a sheet of paper. This program will use a menu...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
Create a new website using C# & ASP.Net in Visual Studio: 1. Create a web page...
Create a new website using C# & ASP.Net in Visual Studio: 1. Create a web page to access a database and display the data from a table by providing an SQL statement. Create the page with these requirements:     create label, textbox and button     the textbox will capture the SQL statement     the button will process the statement and display the results 2. Add necessary data access pages to your project. 3. Display the data in Gridview
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT