STAGES OF LIFE You will develop a program to let the user to know important even
ID: 3904720 • Letter: S
Question
STAGES OF LIFE You will develop a program to let the user to know important events of life in a selected year. The stages are based on Erikson's Theory of Psychosocial Development. Your program must follow the format that is shown in the screen shots below. AGE O to 18 years 19 to 39 years 40 to 64 years 65 to death PSYCHOSOCIAL DEVELOPMENT STAGES Exploration & School Social Relationships& Work Work & Parenthood Reflection on Life INPUTS Current year (See the screenshots below) INTEGER The user's current age (See the screenshots below) INTEGER Another year to calculate user age and find out the Important Events (See the screenshots below) OUTPUT: The age of the User in that particular year (See the screenshots below) INTEGER Important Events in that year based on above given Erikson's Theory of Psychosocial Development stages (See the screenshots below) MESSAGES WARNING MESSAGE 1 NO NEGATIVE AGE: There must be a warning message of "NO NEGATIVE AGE!" if user enters "another year" smaller than his/her birth year. See the screen shots below. WARNING MESSAGE 2 NO AGES MORE THAN 95: There must be a warning message of "NO AGES MORE THAN 95" if user enters "another year" that than hits the max age limit. See the screen shots below.Explanation / Answer
here is your program : ------------->>>>>>>>>>.
#include<iostream>
using namespace std;
int main(){
int birthYear;
int currentYear;
int age;
int anotherYear;
int ageOnAnotherYear;
while(true){
cout<<" Enter Current Year : (INTEGER) ";
cin>>currentYear;
if(currentYear > 0){
break;
}
cout<<" No Negative year! ";
}
while(true){
cout<<" Enter Your Current Age : (INTEGER) ";
cin>>age;
if(age > 0){
birthYear = currentYear - age;
break;
}
cout<<" No Negative Age! ";
}
while(true){
cout<<" Enter Another Year : (INTEGER) ";
cin>>anotherYear;
if(anotherYear < birthYear){
cout<<" No Negative Age ! ";
}
else if(anotherYear > birthYear+95){
cout<<" No Ages More Than 95 !";
}else{
ageOnAnotherYear = anotherYear - birthYear;
break;
}
}
cout<<" Your Age On "<<anotherYear<<" is "<<ageOnAnotherYear<<" ";
if(ageOnAnotherYear <= 18){
cout<<" Event : Exploration & School ";
}else if(ageOnAnotherYear <= 39){
cout<<" Event : Social Relationship & Work ";
}else if(ageOnAnotherYear <= 64){
cout<<" Event : Work & Parenthood ";
}else{
cout<<" Event : Reflextion on Life ";
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.