Question

In: Computer Science

In C++ Instructions: Use a void function to print the following message (should be in welcome...

In C++

Instructions:

Use a void function to print the following message (should be in welcome function)

Welcome to the Event Scheduling program

create 3 int arrays with 3 positions (one array for days one array for moths and one array for years) (should be in main)

Create a file that contains the following (you can just create the file or write the file in the program)

1 / 26 / 2021

12 / 13 / 2020

2 / 1 / 2021

Read the file and place the day, month and year for each date into the appropriate array (should be in main)

ask the user to type  a date in the following format (should be in main)

<day> / <month> / <year>

Determine whether the date the user entered is the same as any of the dates in your arrays (should be in dateCompare function)

If the date does not match any of the dates in the arrays then print the following message:

<day> / <month> / <year> is available. We will add you to our calendar (should be in printMessage function)

If the date does match any of the dates in the array then print the following message:

<day> / <month> / <year> is not available. Please try again with a different date (should be in printMessage function)

Ask the user if they want to enter more dates(should be in main)

if the user answers “yes” then repeat steps 5-8 (should be in main)

if the user answer “no” then print the following message: Thanks for using the Event Scheduling program(should be in main)

if the user types anything else then print the following message:

Did not follow instructions(should be in main)

Here are the functions you need    

Function name | Parameters | Return Type

heading | N/A | void

dateCompare | days,months,years,day,month,year | bool

printMessage | day,month,year | void

EXAMPLE

Welcome to the Event Scheduling program

Please enter a date in the following format: <day> / <month> / <year> (example: 2 / 15 / 2020)

1 / 26 / 2021

1 / 26 / 2021 is not available. Please try again with a different date.

Would you like to enter more dates? (Enter yes/no)

yes

Please enter a date in the following format: <day> / <month> / <year> (example: 2 / 15 / 2020)

1 / 27 / 2021

1 / 27 / 2021 is available. We will add you to our calendar.

Would you like to enter more dates? (Enter yes/no)

no

Thanks for using the Event Scheduling program

Solutions

Expert Solution

Hi please find the c++ code, will add the dateCompare function there is power cut happening here, once it is back i will update the dateCompare function as well please find the rest of the solutiob below
Thanks

#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

void printMessage(string s){
   cout << s << endl;
}
void welcome(){
printMessage("Welcome to the Event Scheduling program");
}
bool dateCompare(string s, int date[], int month[], int year[] ){
  
}
int main() {
   //welcome function
   welcome();
  
   //3 arrays (one array for days one array for moths and one array for years)
   int date[3] = {23,13,1};
   int month[3] = {1,12,2};
   int year[3] = {2021,2020,2021};
  
   string input = "yes";
   while (input != "no"){
       if (input == "yes"){
           printMessage("Please enter a date in the following format: <day> / <month> / <year> (example: 2 / 15 / 2020)");
          
           //takes input date
           getline(cin,input);
          
           bool result = dateCompare(input,date,month,year);
           string msg="";
           if (result){
               msg = input + " is not available. Please try again with a different date.";
           }
           else{
               msg = input + " is available. We will add you to our calendar.";
           }
           printMessage(msg);
       }
       else{
           //add more if you like
           string help = "Did not follow instructions \nHere are the functions you need \n dateCompare \n printMessage";
           printMessage(help);
       }
       printMessage("Would you like to enter more dates? (Enter yes/no)");
      
       //get yes/no
       getline(cin,input);
   }
   printMessage("Thanks for using the Event Scheduling program");
return 0;
}


Related Solutions

Instructions (in C++): 1 ) Use a void function to print the following message (should be...
Instructions (in C++): 1 ) Use a void function to print the following message (should be in welcome function) Welcome to the Event Scheduling program 2 ) create 3 int arrays with 3 positions (one array for days one array for moths and one array for years) (should be in main) 3 ) Create a file that contains the following (you can just create the file or write the file in the program) 1 / 26 / 2021 12 /...
Write in C++ Print the following heading (should be in heading function) Welcome to Reference parameters...
Write in C++ Print the following heading (should be in heading function) Welcome to Reference parameters 2 ) ask the user for 2 numbers (should be in main) 3 ) Calculate the sum and product of the numbers using reference parameters (should be in getAnswer function) 4 ) Print the sum and product of the numbers in the following format: (should be in printmessage function) Here is the function you need        Function name | Parameters                       | Return Type    heading |...
Instructions from your teacher: Write a Python program that does the following: Displays a welcome message...
Instructions from your teacher: Write a Python program that does the following: Displays a welcome message Prompts a user to enter a number (an integer), and then converts that value from inches to feet. If the user entered a negative number, display an error message telling the user that it was not a "positive " number and prompt the user to enter a number again. Displays the converted value, then " feet" Continue converting the user's valid values until the...
1.  Complete the second printSalutation() method to print the following given personName "Holly" and customSalutation "Welcome": Welcome,...
1.  Complete the second printSalutation() method to print the following given personName "Holly" and customSalutation "Welcome": Welcome, Holly End with a newline. What I am given: import java.util.Scanner; public class MultipleSalutations { public static void printSalutation(String personName) { System.out.println("Hello, " + personName); } //Define void printSalutation(String personName, String customSalutation)... /* Your solution goes here */ public static void main (String [] args) { printSalutation("Holly", "Welcome"); printSalutation("Sanjiv"); } } 2. Write a second convertToInches() with two double parameters, numFeet and numInches, that...
(True or False) The following function will compile. void print(int num) { return num+1; } Group...
(True or False) The following function will compile. void print(int num) { return num+1; } Group of answer choices True False Flag this Question Question 2 10 pts (True or False) The following code will output "I was true". bool isGreater(string s1, string s2) { if(s1 > s2) { return true; } return false; } int main() { if(isGreater("before","back")) { cout << "I was true"; } else { cout << "I was false"; } return 0; } Group of answer...
Make a function definition in C for the following: void insert (double *b, int c, double...
Make a function definition in C for the following: void insert (double *b, int c, double s, int pos); //Insert value s at position pos in array. //needs: // c > 0, pos >= 0, and pos <= c-1. Elements b[0]...b[c-1] exist. //this will do: //Elements from indexes pos up to c-2 have been moved up to indexes pos+1 up to c-1. The value s has been copied into b[pos]. //Note: the data that was in b[c-1] when the function...
Program must use Python 3 Your program must have a welcome message for the user. Your...
Program must use Python 3 Your program must have a welcome message for the user. Your program must have one class called CashRegister. Your program will have an instance method called addItem which takes one parameter for price. The method should also keep track of the number of items in your cart. Your program should have two getter methods. getTotal – returns totalPrice getCount – returns the itemCount of the cart Your program must create an instance of the CashRegister...
C++ Write the C++ code for a void function that prompts the user to enter a...
C++ Write the C++ code for a void function that prompts the user to enter a name, and then stores the user's response in the string variable whose address is passed to the function. Name the function getName.
Java Programing Display any welcome message at the top of the output screen Create following variables:...
Java Programing Display any welcome message at the top of the output screen Create following variables: Price for a cup of coffee (make it adjustable within the program) Number of cups (response from User) Tax Rate in San Diego is 8%. Define 8% as a CONSTANT variable that never changes Payment Method (Cash, Credit Card, Store Credit, Gold) Ask the customer for their first name, and store it as a String object. Ask the customer (by name) how many cups...
In c++ Rewrite the following recursive method into an iterative function.  void mystery (int n) {  ...
In c++ Rewrite the following recursive method into an iterative function.  void mystery (int n) {    cout<<"? ";    if (n > 0)      mystery (n - 1); }
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT