Question

In: Computer Science

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 / 13 / 2020
2 / 1 / 2021
4 ) Read the file and place the day, month and year for each date into the appropriate array (should be in main)
5 ) ask the user to type a date in the following format (should be in main)
<day> / <month> / <year>
6 ) Determine whether the date the user entered is the same as any of the dates in your arrays (should be in dateCompare function)
7a) 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)
7b) 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)
8 ) Ask the user if they want to enter more dates(should be in main)
9a ) if the user answers “yes” then repeat steps 5-8 (should be in main)
9b ) if the user answer “no” then print the following message: Thanks for using the Event Scheduling program(should be in main)
9c ) if the user types anything else then print the following message:
Did not follow instructions(should be in main)

Solutions

Expert Solution

#include <iostream>
#include <fstream>
using namespace std;

Class Program()

{

Public:

int date[200], a= 0,x,date_read[30];

char answer;

void message()

{

std::cout << "Welcome to the Event Scheduling program";

}

void date_display(int date[10], int& mon , int& year[10])
 {
   for(i=0;i<10;i++)
    {    
    year[i] = date[i] / 10000;
    date[i] %= 10000;
     month [i]= date[i] / 100;
   }
 for(i=0;i<10;i++)
 {    
    cout << endl << "Year: " << year[i]
             << endl << "Day : " << day[i]
             << endl << "Month:" << mon[i];
  }
}
void file_write ()
  {
   fstream file_op;
   file_op ("file_date", ios::out | ios::in );
   fstream file;
   date = 22102020
   cout << "Write date in file." << endl;
   cin.getline(date, sizeof(date));
   // Writing on file
   File_op << date << endl;
  }
void file_read()
{   
   // check that array is not already full
   while (a < date_read[30] && is >> x)
   // read integer from file
   Date_read[a++] = x;
   // print the integers stored in the array
   cout<<"The dates are:"<<"\n";
   for (int i = 0; i < a; i++) {
      cout << read_date[i] <<' ';
   }
   //close the file
   is.close();
}
int main()
 {
    // create object of program class
    Program prog;
    while(true)
    {
        cout<<"Do you want to continue?(Y/N)"<<endl;
        cin >> answer;
        if(answer == 'Y'|| answer =='y'){
        return true;
        }
else if(choice =='N'||choice =='n')
{
        return false;
        }
else
{
Print(“Enter right choice”)
 }
return 0;
}
 
 
 

Related Solutions

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...
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 |...
(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...
c++ Write a program that print stars, Max and Min values. It should use the following...
c++ Write a program that print stars, Max and Min values. It should use the following functions: (2 pts) int getNum ( ) should ask the user for a number and return the number. This function should be called by main once for each number to be entered. Input Validation: Do not accept numbers less than -100. (2 pts) void printStars ( int n ) should print n number of stars. If n is less than 0, display "Invalid" message...
Even Odd Average (C++ LANGUAGE) Write the following functions: Function #1 Write the function Print. The...
Even Odd Average (C++ LANGUAGE) Write the following functions: Function #1 Write the function Print. The function will have one int 1D array n and one int size as parameters. The function will display all the values of n on one line. Function #2 Write the function AverageEvenOdd. The function will have one int 1D array n and one int size as parameters. The size of the array is given by the parameter int size. Therefore, the function should work...
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...
3. [Method 1] In the Main class, write a static void method to print the following...
3. [Method 1] In the Main class, write a static void method to print the following text by making use of a loop. Solutions without a loop will receive no credit. 1: All work and no play makes Jack a dull boy. 2: All work and no play makes Jack a dull boy. 3: All work and no play makes Jack a dull boy. 4: All work and no play makes Jack a dull boy. 4. [Method 2] In the...
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.
If the action is Balance 'B’, use a print balance function to return and print an...
If the action is Balance 'B’, use a print balance function to return and print an account balance. You will need to write a function called printbalance. a. Create a prompt for the user to input the account action. There are three possible actions: Code Action Function D Deposit deposit_amount W Withdrawal withdrawal_amount B Account Balance account_balance Create a function to print the account_balance, print the account actions and create the action for outputting the account balance outputting. Input Information...
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