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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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