Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Visual Studio C++ Programming Project: Birthdays Standards: Your program must use good variable names. All input must have a good prompt so that the user

Visual Studio C++ Programming Project: Birthdays

Standards:

Your program must use good variable names.

All input must have a good prompt so that the user knows what to enter.

All output must clearly describe what is output.

The program must be your own work.

Steps:

YOU MUST USE THE DATE.CPP class

#include "Date.h"

Date::Date() { time_t t = time(0); // get time now struct tm * now = localtime(&t); month = now->tm_mon + 1; day = now->tm_mday; year = now->tm_year + 1900; setDays(); }//constructor for today: cross platform /*Date::Date() { struct tm newtime; __time64_t long_time; char timebuf[26]; errno_t err; // Get time as 64-bit integer. _time64( &long_time ); // Convert to local time. err = _localtime64_s( &newtime, &long_time ); month=newtime.tm_mon+1; day=newtime.tm_mday; year=newtime.tm_year+1900; setDays(); }//constructor for today for Visual Studio */ bool validDate(int m, int d, int y) { int days2[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }; bool valid=true; //assume it is valid until found to be invalid if(y<1000) valid=false; if(m<1 || m>12) valid=false; if (valid) { if (leapYear(y)) days2[2] = 29; if (d<1 || d>days2[m]) valid = false; } return valid; }//validDate void Date::setDays(void) { int days2[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }; for (int m = 0; m < 13; m++) days[m] = days2[m]; if (leapYear()) days[2] = 29; } Date::Date(int m, int d, int y) { //constructor to assign values to month day and year if(validDate(m,d,y)) { month=m; day=d; year=y; } else { month=day=1; year=1970; //Unix time starting point } //not valid: set to default valid date for(int m=0;m<13;m++) days[m]=days2[m]; } //constructor with assigned values Date::Date(int julian) { //Fliegel-Van Flandern algorithm to convert Julian date to Gregorian number month, day, and year gregorian(julian,month,day,year); setDays(); }//Date Julian Date::Date (string str) { //constructor for todays date as "mm/dd/year //Parse str by adding one char at a s time to the token until a "/" is encounter. //When "/" is encountered start the next token //int p=0; int count=0; int num[3]; string token[3]; int len=str.length(); for(int p=0; p(const Date& otherDate) { //Convert both dates to Julian and compare the Julian dates int jd1=julian(); int jd2=otherDate.julian(); return jd1>jd2; }//operator> ostream& operator << (ostream &output, const Date &d) { output << d.toString(); return output; } // operator << istream& operator >> (istream &input, Date &d) { string s; input >> s; Date other(s); //create a new Date d=other; //assign the new Date to d return input; } // operator >> 

Create a file with several people. Each line in the file has one person: Amy Lynn,3/17/2010 or Mark,12/21/1992.

Create a structure person with string name, and Date birthdate, and date birthday. For example Marks birthdate is 12/21/1992, but his birthday is 12/21/2018. (this year).

Read in the file and create a Vector of the birthdays from the file.

Print out the list of people with their name and birthday and age.

The list of people:

Mark,12/21/1992 Jay,9/29/1974 Amy Lynn,3/17/2010 Bill,12/18/1985 Julie,7/10/1980 Debbie,5/21/1976 Paul,1/3/2001 Ian,2/29/1980 Josh,10/31/2003 Karen,8/24/2011 

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

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago