This program will have names and addresses saved in a linked list. In addition,
ID: 669372 • Letter: T
Question
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 menu.
Items on the menu should include:
• Enter a new name into the address book
• Delete a name from the address book
• Change a name or date in the address book
• Display the whole address book
• Generate birthday cards
• Generate anniversary cards
• Exit the card program
Each of these sections will call individual functions to perform their appropriate task.
This address book is to be sorted in alphabetical order. Be aware of this when you are entering,
deleting, or changing the name, and plan your code accordingly. Use classes and objects where
appropriate. Be sure to comment your code and use appropriate variable, function, and class
names so that it is clear how the program flows.
The user gets the menu and creates information to be stored in your address book. (To save
sanity in testing, you may fill in 5 or 6 records within the code or written to a file to start your
address book.) The user can add a new record to your existing ones, delete a record, modify a
record or print the whole address book on the screen. For each of the options, make sure you
give suitable prompts on the screen so that the user knows what is expected by the program.
Expect that the user will enter both a birthday and anniversary date. (If you’d like, you can handle
the situation where the user chooses not to enter an anniversary date.) A year may be entered or
omitted in birthday and anniversary dates. Also be sure to redisplay the menu any time a function
has concluded, until the user presses the Exit option.
Create and display the card created on the screen (you do not need to print it). You may design
the layout of the card as you wish. For example, it could be:
Dear <fname>,
Hope your birthday is really wonderful and this coming year is the best yet!
Love,
Joanne
“Generate Birthday Cards” and “Generate Anniversary Cards” will use the system date (today) as
the date to match. Using this date, display the card below it on the screen. Be ready to print
multiple cards if more than one birthday or anniversary falls on the same day.
“Display the Whole Address Book” will be done on the screen. Output should look something like:
Wilson, Fred
123 Main Street
Anytown, NJ 00000
Birthday: May 7
Anniversary: June 25
Or include the structure variable names you’ve used:
lname: Wilson fname: Fred
addr: 123 Main Street
city: Anytown state: NJ zip: 00000
bday: May 7
aday: June 25
Explanation / Answer
01 #include 02 #define ID_BUTTON 1 03 #define ID_EDIT 2 04 05 06 07 /* This is where all the input to the window goes to */ 08 LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { 09 switch(Message) { 10 { 11 case WM_CREATE:{ 12 13 HMENU hMenuBar = CreateMenu(); 14 HMENU hFile = CreateMenu(); 15 HMENU hOption = CreateMenu(); 16 HMENU hHelp = CreateMenu(); 17 18 19 AppendMenu(hMenuBar, MF_POPUP, (UINT_PTR)hFile, "Menu"); 20 AppendMenu(hMenuBar, MF_POPUP, (UINT_PTR)hOption, "Options"); 21 AppendMenu(hMenuBar, MF_POPUP, (UINT_PTR)hHelp, "Help"); 22 23 24 AppendMenu(hFile, MF_STRING, NULL, "Enter a new name into the address book"); 25 AppendMenu(hFile, MF_STRING, NULL, "Delete a name from address book"); 26 AppendMenu(hFile, MF_STRING, NULL, "Change a name or date in address book"); 27 AppendMenu(hFile, MF_STRING, NULL, "Generate birthday cards"); 28 AppendMenu(hFile, MF_STRING, NULL, "Exit the card program"); 29 30 AppendMenu(hOption, MF_STRING, NULL, "Cancel Order"); 31 AppendMenu(hOption, MF_STRING, NULL, "Reset Order"); 32 AppendMenu(hHelp, MF_STRING, NULL, "Points of contact"); 33 AppendMenu(hHelp, MF_STRING, NULL, "Email us"); 34 SetMenu(hwnd, hMenuBar); 35 36 37 CreateWindow(TEXT("BUTTON"), TEXT("Process Order"), 38 WS_CHILD | WS_VISIBLE, 39 10, 200, 100, 30, 40 hwnd, (HMENU) ID_BUTTON, NULL, NULL 41 ); 42 break; 43 44 CreateWindow(TEXT("EDIT"), TEXT("Enter name, birthday or anniversary date"), 45 WS_CHILD | WS_VISIBLE | WS_BORDER, 46 10, 100, 200, 30, 47 hwnd, (HMENU) ID_EDIT, NULL, NULL 48 ); 49 break; 50 break;Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.