
PROGRAM :
#include<iostream>
#include <iomanip>
using namespace std;
class Time
{
private:
int hh,mm;
public:
void getTime(void);
void displayTime(void);
};
void Time::getTime(void)
{
cout << "Enter time:" << endl;
cout << "Hours? "; cin >> hh;
cout << "Minutes? "; cin >> mm;
}
void Time::displayTime(void)
{
cout << "The time is = " << setw(2) <<
setfill('0') << hh << ":"
<< setw(2) << setfill('0') << mm ;
}
int main()
{
int in;
char event_title[40];
cout<<"Welcome Message"<<endl;
cout<<"***Main Menu***"<<endl;
cout<<"[1] Add one event"<<endl;
cout<<"[2] Delete one event"<<endl;
cout<<"[3] Add events in batch"<<endl;
cout<<"[4] Show events"<<endl;
cout<<"[5] Credits"<<endl;
cout<<"[6] Exit"<<endl;
cout<<"******************"<<endl;
cout<<"Option (1-6):"<<endl;
cout<<"Select options from Main Menu"<<endl;
cin>>in;
switch(in)
{
case 1: cout<<"Enter the following
information:"<<endl;
int dd,mm,yyyy,et;
cout<<"Event Title"<<endl;
cin>>event_title;
cout<<"Event Date"<<endl;
cin>>dd>>mm>>yyyy;
if(yyyy>=1900 && yyyy<=9999) //check year
{
//check month
if(mm>=1 && mm<=12)
{
//check days
if((dd>=1 && dd<=31) && (mm==1 || mm==3 ||
mm==5 || mm==7 || mm==8 || mm==10 || mm==12))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else if((dd>=1 && dd<=30) && (mm==4 || mm==6
|| mm==9 || mm==11))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else if((dd>=1 && dd<=28) && (mm==2))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else if(dd==29 && mm==2 && (yyyy%400==0
||(yyyy%4==0 && yyyy%100!=0)))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else
cout<<"date is invalid"<<endl;
}
else
{
printf("Month is not valid.\n");
}
}
else
{
printf("Year is not valid.\n");
}
cout<<"Event Start time"<<endl;
Time T; //creating objects
T.getTime();
T.displayTime();
cout<<endl;
cout<<"Event End time"<<endl;
T.getTime();
T.displayTime();
cout<<endl;
cout<<"Event Type"<<endl;//Value should be between 1
and 4;
cin>>et; //(1)Home (2)Work (3) Study (4) Play
main();
break;
case 2 : cout<<"Enter the date of event that you want to
be deleted"<<endl;
cin>>dd>>mm>>yyyy;
if(yyyy>=1900 && yyyy<=9999) //check year
{
//check month
if(mm>=1 && mm<=12)
{
//check days
if((dd>=1 && dd<=31) && (mm==1 || mm==3 ||
mm==5 || mm==7 || mm==8 || mm==10 || mm==12))
cout<<"Event is deleted"<<endl;
else if((dd>=1 && dd<=30) && (mm==4 || mm==6
|| mm==9 || mm==11))
cout<<"Event is deleted"<<endl;
else if((dd>=1 && dd<=28) && (mm==2))
cout<<"Event is deleted"<<endl;
else if(dd==29 && mm==2 && (yyyy%400==0
||(yyyy%4==0 && yyyy%100!=0)))
cout<<"Event is deleted"<<endl;
else
cout<<"date is invalid"<<endl;
}
else
{
printf("Month is not valid.\n");
}
}
else
{
printf("Year is not valid.\n");
}
main();
case 3 : cout<<"Add events in the batch"<<endl;
// Format of one event is DD-MM-YYYY/hh-mm/hh-mm/Event
Title/X
cout<<"Event Date"<<endl;
cin>>dd>>mm>>yyyy;
if(yyyy>=1900 && yyyy<=9999) //check year
{
//check month
if(mm>=1 && mm<=12)
{
//check days
if((dd>=1 && dd<=31) && (mm==1 || mm==3 ||
mm==5 || mm==7 || mm==8 || mm==10 || mm==12))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else if((dd>=1 && dd<=30) && (mm==4 || mm==6
|| mm==9 || mm==11))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else if((dd>=1 && dd<=28) && (mm==2))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else if(dd==29 && mm==2 && (yyyy%400==0
||(yyyy%4==0 && yyyy%100!=0)))
cout<<dd<<"-"<<mm<<"-"<<yyyy<<endl;
else
cout<<"date is invalid"<<endl;
}
else
{
printf("Month is not valid.\n");
}
}
else
{
printf("Year is not valid.\n");
}
cout<<"Event Start time"<<endl;
T.getTime();
//T.displayTime();
cout<<endl;
cout<<"Event End time"<<endl;
T.getTime();
//T.displayTime();
cout<<endl;
cout<<"Event Type"<<endl;//Value should be between 1
and 4;
cin>>et; //(1)Home (2)Work (3) Study (4) Play
cout<<dd<<"-"<<mm<<"-"<<yyyy<<"/"<<et<<endl;//You
cam also display time here using displayTime() method;
main();
default : cout<<"Invalid input"<<endl;
break;
}
return 0;
}
NOTE : Save this program with .cpp extension to get your program run.
please write C++ code to finish R0,R1,R2 Introduction In this assignment, you are going to develop...
Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the system by entering his or her user-id and a secret password, the system must check the validity of this user-id and password to verify that this is a legitimate user. Because this validation must be done many times each day, it is necessary to structure this information in...
Use python to code!
Q1 - You need to keep track of book titles. Write code using
function(s)
that will allow the user to do the following.
1. Add book titles to the list.
2. Delete book titles anywhere in the list by value.
3. Delete a book by position.
Note: if you wish to display
the booklist as a vertical number booklist , that is ok
(that is also a hint)
4. Insert book titles anywhere in the list....
Develop a flowchart and then write a menu-driven C++ program that uses several FUNCTIONS to solve the following program. -Use Microsoft Visual C++ .NET 2010 Professional compiler using default compiler settings. -Use Microsoft Visio 2013 for developing your flowchart. -Adherence to the ANSI C++ required -Do not use <stdio.h> and <conio.h>. -Do not use any #define in your program. -No goto statements allowed. Upon execution of the program, the program displays a menu as shown below and the user is prompted to make a selection from the menu....
Please do not copy other solution from the site as they never fully implement all the listed guidelines below. Please write a shell script called atm.bash similar to the ones used in ATM machines. Essentially your script is to handle a person's savings and checking accounts and should handle the following services: Transfer from savings account to checking account Transfer from checking account to savings account Cash withdrawal from either account Balance statements for both the...
Write a Java Program that performs the following functionalities: and you can use if statements, cases, and string methods Enter a new main sentence Find a String Find all incidents of a String Find and Replace a String Replace all the incidents of a String Count the number of words Count a letter’s occurrences Count the total number of letters Delete all the occurrences of a word Exit The program will display a menu with each option above, and then...
In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...
Please help with this C++ code. If possible comment the code and please send screenshots of the code. This assignment involves creating a program to track employee information. Keep the following information on an employee: Employee ID (string) Last name (string) First Name (string) Birth date (string as MM/DD/YYYY) Gender (M or F, single character) Start date (string as MM/DD/YYYY) Salary per year (double) Thus you must create a class that has all of this, and get/set methods for each...
Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...
C++ : Please include complete source code in answer This program will have names and addresses saved in a linked list. In addition, a birthday and anniversary date will be saved with each record. When the program is run, it will search for a birthday or an anniversary using the current date to compare with the saved date. It will then generate the appropriate card message. Because this will be an interactive system, your program should begin by displaying a...
Total point: 15 Introduction: For this assignment you have to write a c program that will take an infix expression as input and display the postfix expression of the input. After converting the postfix expression, the program should evaluate the expression from the postfix and display the result. What should you submit? Write all the code in a single file and upload the .c file. Problem We as humans write math expression in infix notation, e.g. 5 + 2 (the...