How can I display and calculate within this code? This is the assignment: calculate and return the physical, emotional, and mental values based on a given number of days alive. calcBiorhythmValues() display the biorhythm values in an ASCII-graphics format for a given display period, displayBiorhythms() As of now this is what I have as a working code without the functions. Copy of Code: #include using namespace std; int daysAlive(); int numDaysReport(); void BioProcessed(int numDaysReport, int daysAlive); void calcValues(int numDaysReport, int&, int&, int&); void printValues(int, int&, int&, int&); int main(void){ int days = daysAlive(); int report = numDaysReport(); BioProcessed (report, days); return0; } int daysAlive (){ int d; cout << "How many days have you been alive? "; cin >> d; return d; } int numDaysReport (){ int n; cout << "How many days would you like to be reported? "; cin >> n; return n; } void BioProcessed (int numDaysReport, int daysAlive){ cout << "This report is for someone who has been alive "; cout << daysAlive << endl; int physical; int emotional; int mental; for(int i =0; i < numDaysReport; i++){ calcValues(daysAlive + i, physical, emotional, mental); printValues(daysAlive + i, physical, emotional, mental); } } void calcValues(int daysAlive, int& physical, int& emotional, int& mental){ physical = sin(2 * 3.14592 * daysAlive / 23.0) * 25 + 25; emotional = sin(2 * 3.14592 * daysAlive / 28.0) * 25 + 25; physical = sin(2 * 3.14592 * daysAlive / 33.0) * 25 + 25; } void printValues(int daysAlive, int& physical, int& emotional, int& mental){ cout << "Day: " << daysAlive << "\t" << physical << "\t" << emotional << "\t" << mental << endl; string output = ".........................|........................."; output[physical] = 'P'; output[emotional] = 'E'; output[mental] = 'M'; cout << output << endl; }
How can I display and calculate within this code? This is the assignment: calculate and return the physical, emotional, and mental values based on a given number of days alive. calcBiorhythmValues() display the biorhythm values in an ASCII-graphics format for a given display period, displayBiorhythms() As of now this is what I have as a working code without the functions. Copy of Code: #include using namespace std; int daysAlive(); int numDaysReport(); void BioProcessed(int numDaysReport, int daysAlive); void calcValues(int numDaysReport, int&, int&, int&); void printValues(int, int&, int&, int&); int main(void){ int days = daysAlive(); int report = numDaysReport(); BioProcessed (report, days); return0; } int daysAlive (){ int d; cout << "How many days have you been alive? "; cin >> d; return d; } int numDaysReport (){ int n; cout << "How many days would you like to be reported? "; cin >> n; return n; } void BioProcessed (int numDaysReport, int daysAlive){ cout << "This report is for someone who has been alive "; cout << daysAlive << endl; int physical; int emotional; int mental; for(int i =0; i < numDaysReport; i++){ calcValues(daysAlive + i, physical, emotional, mental); printValues(daysAlive + i, physical, emotional, mental); } } void calcValues(int daysAlive, int& physical, int& emotional, int& mental){ physical = sin(2 * 3.14592 * daysAlive / 23.0) * 25 + 25; emotional = sin(2 * 3.14592 * daysAlive / 28.0) * 25 + 25; physical = sin(2 * 3.14592 * daysAlive / 33.0) * 25 + 25; } void printValues(int daysAlive, int& physical, int& emotional, int& mental){ cout << "Day: " << daysAlive << "\t" << physical << "\t" << emotional << "\t" << mental << endl; string output = ".........................|........................."; output[physical] = 'P'; output[emotional] = 'E'; output[mental] = 'M'; cout << output << endl; }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
How can I display and calculate within this code?
This is the assignment:
- calculate and return the physical, emotional, and mental values based on a given number of days alive. calcBiorhythmValues()
- display the biorhythm values in an ASCII-graphics format for a given display period, displayBiorhythms()
As of now this is what I have as a working code without the functions.
Copy of Code:
#include <bits/stdc++.h>
using namespace std;
int daysAlive();
int numDaysReport();
void BioProcessed(int numDaysReport, int daysAlive);
void calcValues(int numDaysReport, int&, int&, int&);
void printValues(int, int&, int&, int&);
int main(void){
int days = daysAlive();
int report = numDaysReport();
BioProcessed (report, days);
return0;
}
int daysAlive (){
int d;
cout << "How many days have you been alive? ";
cin >> d;
return d;
}
int numDaysReport (){
int n;
cout << "How many days would you like to be reported? ";
cin >> n;
return n;
}
void BioProcessed (int numDaysReport, int daysAlive){
cout << "This report is for someone who has been alive ";
cout << daysAlive << endl;
int physical;
int emotional;
int mental;
for(int i =0; i < numDaysReport; i++){
calcValues(daysAlive + i, physical, emotional, mental);
printValues(daysAlive + i, physical, emotional, mental);
}
}
void calcValues(int daysAlive, int& physical, int& emotional, int& mental){
physical = sin(2 * 3.14592 * daysAlive / 23.0) * 25 + 25;
emotional = sin(2 * 3.14592 * daysAlive / 28.0) * 25 + 25;
physical = sin(2 * 3.14592 * daysAlive / 33.0) * 25 + 25;
}
void printValues(int daysAlive, int& physical, int& emotional, int& mental){
cout << "Day: " << daysAlive << "\t" << physical << "\t" << emotional << "\t" << mental << endl;
string output = ".........................|.........................";
output[physical] = 'P';
output[emotional] = 'E';
output[mental] = 'M';
cout << output << endl;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education