Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming in C/C++ Submit your source code files (all .h and .cpp files) NO GLOBAL VARIABLES Program: Use operator overloaded functions for a birthday club

Programming in C/C++

  • Submit your source code files (all .h and .cpp files)
  • NO GLOBAL VARIABLES

Program: Use operator overloaded functions for a birthday club Based on Chapter 11 lecture (25 pts)

Make a class called Birthday that will have a date of month, day, and year and the name.

Need to have overloaded operators to compare values along with regular functions like:

  • Overload operator == that takes a Birthdate, compares against the current date values, and returns a boolean
  • Overload operator > that takes a Birthdate, compares against the current date values (years are the most significant down to least significant day)
  • Also need getName (not overloaded)
  • And setBirthdate, that will take the month, day, year and name

Have a friend function of operator<<:

It will have the prototype of: ostream& operator<<(ostream&, Birthdate&);

With that operator<<, you need to return the ostream& parameter to ensure the output stream works properly.

Then create two functions: sort and search

They will take the array of BirthDate and either sort or search just regular functions that are NOT part of the BirthDate class (but they do use the overloaded operators).

Main should print your name birthday club then create an array of Birthdate, open a data file, and read in the birthdays and name into the array (assume that the name is a single word). Sort the array using the bubblesort and the overloaded operator of > to sort by date. Print the entire array then have a do/while loop that will input a date and search for it (a simple search is fine). Have it print the index if found, else print not found. Have it end on negative values.

Create a data file with values such as:

12 15 1988 Mustang Sally

1 31 1967 George Porge

4 7 1992 Nancy Meme

7 9 2001 Tim Breakum

10 23 1978 Markus Mark IV

9 1 1984 Bill Jones

To test the program with.

10 points extra credit, add to the program to template the bubblesort and have a double array of 10 monetary values (cash gifts) random from $1 to $49.99, sort that array also, and print the cash gifts formatted.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions