Write a program to go through your address book

Assignment Help Programming Languages
Reference no: EM13784265

Everyone has at least one friend who always remembers everyone's birthday. Write a program to go through your address book and print the names and phone numbers of all people who have birthdays on that day, so you can give them a call.

For this program you MUST use the following struct, the classand the non member function

struct Date { int month; int day;

};

classDatetype

{ public:

void set(intnew_month, intnew_day);

// date set according to the incoming parameters

// this function calls the check_date function.

intget_month(); // accessor function

intget_day();

private:

voidcheck_date();

Date bday;

};

bool compare(Datetype d1, Datetype d2);

// returns true if d1 and d2 represent same month and day;

//otherwise returns false

Input: Today's month and day (from the keyboard); and a list of names, phone numbers, and birthdates (from the data file). Entries in the file - Friendfile.dat are in the form

PROUD NORMA 555-256-1256 3 5 HANDSOME HANLY 800-133-2255 8 15
CLUMSY NORA 740-123-4567 3 5
GLAMOROUS PENNY 760-345-2211 1 25
MONEYBAG JOE 740-589-9876 4 29
Etc..
Output:The names and phone numbers of any friends whose birthdays are on that day.
Sample output is as follows: If no one has a birthday on that day, just print the message
"No birthdays today"

Enter today's month and day 3 5

PROUD NORMA 555-256-1256
CLUMSY NORA 740-123-4567
Hints:

Create a separate directory for this assignment.

First you need to declare two objects of the Datetype. - one store the month and day from the data file and the other to store month and day from the keyboard.

Declare the first,last and the phone_number as sting variables and month and day as integer variables in the function main to store the values read from the data file.

Then you enter the today's date (month and day) from the keyboard and call the mutator function (set function) to set the values. This function calls the check_date function.

The check_date function exit the program if month or day is invalid. (pg 562)

You need to use the dotoperator in the set function definition and the check_date function definition and in accessor functions because the bday has two members of the structtype.

Now start with awhile(file_stream>> first >> last >> ...) loop in the main that will read the first line of data in the data file. Call the function set again with the values from the data file. (same as above)

Then call the compare function to compare the two days (month and day). If they are equal print the first, last, phone number to the screen with left justifications.

You can open, check for fail and close the input file in the main.

Don't forget to include the necessary libraries.

Electronic submission /home/kmgsubm/bin/2400submit -p 6

Submit only the source code and the data file. Also turn in your source code on Friday, November 14th.

Scoring for Assignment 6

comments (name, date, good introduction to the program, declaration comments etc)

function main

correct implementation of member non member function in the class 4 points style - indenting, formatting etc. source code

Reference no: EM13784265

Questions Cloud

Key financial terms related issues : Analyze at least three problems that may arise over a long time frame by using the internal rate of return method.
Discussion-migration and immigration : Globalization has caused extensive shifts in the mobility of people between countries. Economics, political shifts, and increased opportunities for travel have made migration and immigration pervasive. This assignment will explore immigration patt..
Write a menu-driven c++ program for food purchases : Write a menu-driven C++ program for food purchases at the baseball stadium's restaurant. The main program will loop allowing the user to select food items from the menu adding each item to the bill, terminating when the user selects the "End order..
Describe e-learning as a training method : Describe e-learning as a training method
Write a program to go through your address book : Everyone has at least one friend who always remembers everyone's birthday. Write a program to go through your address book and print the names and phone numbers of all people who have birthdays on that day, so you can give them a call.
Assignment on organizational theory and design : Organizational Theory and design.
Alternative strategies for the developing venture : Analyze how you can structure your venture to avoid potential exit strategy problems and suggest alternative strategies for the developing venture.
Review the information that explores ceremonial speeches : Review the information presented in Module 8 that explores ceremonial speeches. In particular, focus on the situations in which you might need to present a ceremonial speech.
Discuss the different types of budgets : Discuss the different types of budgets available and how they might be utilized in the criminal justice system.

Reviews

Write a Review

Programming Languages Questions & Answers

  Hru access control matrix model

How will the matrix above result if we execute the command and Write a command delete_object(sub1,sub1) that will delete any occurrences of sub1 if sub1has the right m with itself

  Users selection and return to menu

Create a menu that will allow the user to list all wines by name in alphabetic order and count all wines in each type and list all 5 types with their count

  What are the advantages and disadvantages of a

what are the advantages and disadvantages of a manufacturing company owning and operating its own outbound warehouse

  Arithmetic and application of summaries

Write some R code that carries out computation, but do it with a single R expression that contains no commas (,) and no braces ({}).

  Create a working program for alpha testing

you want to put together the work that has been completed to deliver a working program for alpha testing. You will combine the elements you have written to this point and deliver a working solution.

  Implicit unsafe type conversions-statements and expressions

Write a report using APA format for references that researches the definition of the language with respect to implicit unsafe type conversions in both assignment statements and expressions.

  Create derived class by inheriting tthe class

Create a derived class named FancyDateClass by inheriting the DateClass. You will have to provide both the class definition and implementation.

  Pseudocode that will generate reports from data files

Develop a mock-up of each of these reports, and get customer approval of these mock-ups. Write pseudo code that will generate these reports from the data files, using a CASE tool;

  Implement a tic tac toe game in any programming language

You have to do this assignment to make a game in computer programming language tic tac the boxes of the game should be interactive and in red and green color

  Write a set-list of enumerated constants for week

Write a set/list of enumerated constants called week which contains days of the week. Have variable called today that is of type week. Allot value to today.

  Create ajax-based product catalog

Create an AJAX-based product catalog which obtains its data from JSON files located on the server. The data should be separated into four JSON files.

  Write an assembly code segment that calls the subroutine

Write an assembly code segment that calls the subroutine New Functionif bits 5 and 6 of PORTD equal 1 and write the same code segment in part (a) using structured assembly constructs.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd