Question: Write a C++ program that will calculate your biorhythms for the next 45 days. Enter your birthdate in a file called, bio.txt that is the
Write a C++ program that will calculate your biorhythms for the next 45 days. Enter your birthdate in a file called, bio.txt that is the MM, DD,YYYY separated by commas (this should be old hat by now). Next, include the following code into a file called Calendar.h to get the current MM,DD,YYYY. You can include this .h file into your solution, where needed. Output your result to both the console, and a text file named bio.out.txt. The result should be in a table with an additional column that identifies the best biorhythm day over the next 45.
I am not specifying a class structure. That is for you to work out.
This is an inline class, where the entire class is inside a single .h file. Don't worry about understanding it. Just use it.
#include
class Calendar { private: tm timePtr;
public: Calendar(); int getDay(); int getMonth(); int getYear(); };
inline Calendar::Calendar() { time_t t = time(NULL); localtime_s(&timePtr, &t); }
inline int Calendar::getDay() { return timePtr.tm_mday; }
inline int Calendar::getMonth() { return timePtr.tm_mon + 1; }
inline int Calendar::getYear() { return timePtr.tm_year + 1900; }
Biorhythms are calculated using the following four important formulas:
1. The number of days you have been alive is CurrentNumOfDays - MyNumOfDays;
NumOfDays = 1461 * Year / 4 + 153 * Month / 5 + Day; * You can check an online resource to make sure you are calculating this correctly, like:
http://www.bonkworld.org/Features/view/45 (Links to an external site.)Links to an external site.
2,3,4: The physical, emotional, and mental biorhythm calculations.
TotalDaysAlive = tda;
Physical = 25 * sin(2 * PI / 23 * (tda + Day)); Emotional = 25 * sin(2 * PI / 28 * (tda + Day)); Mental = 25 * sin(2 * PI / 33 * (tda + Day));
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
