Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This needs to be in C++ PROGRAM DESCRIPTION Your program must ask the user seventeen questions in order to calculate and display the user's life

This needs to be in C++

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

PROGRAM DESCRIPTION Your program must ask the user seventeen questions in order to calculate and display the user's life expectancy, PROGRAM INPUT A list of infonnation you must obtain from the user is below: 1. First name of user 2. Current age [starting pocint] 3. Gender (male/female) 4. Current weight (underweight, just right, overweight, obese) 5. Smolve or vape (yeso) 6. Drink more than one alcoholic beverage a day? (yeso) 7. Exercise [none, wery little, periodically, active, athlete) 8. Own pet (yeso) 9. Married \&divorced, sinple, married, happily marriedi 10. Caretaker (yeso) 11. Job thate job, dislike job, it's ok, enjovable, love it!] 12. Eat breaklast toery day (yeso) 13. Parents/grandparents die before age 50 (yeso) 14. Eat fruits daily (yesino) 15. Eat vegetables daily (yeso) 16. Hang out with friends [never, periodically, often] 17. Education Level (Na degrees, HS degree, Associates degree, Bachelors degrea, Masters/PHD degree) PROGRAM SPECIFICATIONS - Indentions \& Commenting follow good programming practice as shown in dass. All lines of code should be indented properly and consistently. There should he a comment block at the top of the source file containing the title (filename), author, date, and purpose. There should be comments throughout your code explaining the major sections of code like input, processing/calculations, and outout. - Variables: (5 If you reeed yeso infurmation, then you shcould rruke the variable a Boolean da ta type. You will have to create a variable that will first hold a char /to get the information) and then you will have to see if the user answered yes and if they did, then you set this Boolean variable to true. Othervise, set it to false. o For information that could have 3 to 5 answers, you should give the user a menu with numbers representing each of the chcices. You should read in the user's response into an integer variable - For male ar female, you should make the variable a char (mor f). - Asking for input - In all prograrns you should ahays make sure that the user can understand exactly what they are supposed to be entering. This prevents communication mistakes between the user \& programmer. o You may assume far this assignment that the user will enter in a valid response and valid data type. - Calculation - If the person is 60 or BELOW, then their starting life expectancy is 60 . n If tha newnn is my/FD fn then their startina lifo emortanru io thair mumant asa inetad - Calculation If the person is 60 or BELOW, then their starting life expectancy is 60 . D If the persan is OVER 60 , then their starting life expectancy is their current age instead. Examplet starting age is 12, then their starting lite expectancy is 60 . - Another Examplet starting age is 63 , then their starting life expectancy is 63 . (- Look at the ctart below to calculale their tesulting life expectancy accurding tu how they arsvered yuur questions. To evaluate their answers, you will need a lot of branching statements. 0 If a resulting (final) life expectancy is lower than the person's current age, then malce the final life expectancy the same as their age. How to Add and Remove Points to lite Fxpectancy - Output - We are goine to be very picky on your output. It should look like what you see in this assignment! - Yes - you DO need ta print cut all the lines that tell the lile expectancy alter each category/calculation. 1) Then, a suw of stars ard then a blank line. - The Name:, Current Age: and Life [xpectancy: column should all be right aligned and have a field width of 22. Nso, when you print out these labels (like Name:), you should add five spaces after the colon. o The answers to name, age \& life expectancy should all be left aligned and have a field width of 30 . Then another blank line Then, a row of stars exactly like the row on the tap. - Refer to sample output. WARNING: This program does not have a difficult algorithm, but it is long. You must start soon or you will not finish the program. Remember there are MANY people on the tearhing staff available 7 days a werk that can help you. Most tutoring is in BFUN 410 but there are other locations, too. Refer to the tutoring schedule (link at top of General channel in our Teamy. SAMPLE OUTPUT 1 All user input is highlighted in yellow. Life Expectancy Calculater All user input is highlighted in yellow. Enter Your name: sgidward Q. Tentaclea Enter your current age: 36 Are yuu male ur Iemale? (EnLer m ur I: m Nhat is your weight status? (1) Jnderweight, (2) Just right, (3) orernoight, (4) obes (Enter 1, 2, 3 r 4)=1 Do you amoke sigaretass? (Bnter y or n) : Y Do you ditink mote than ane al anholie beverage every ding? (Liter y or n ): y Do you rxeraine? (1) None, (2)Very Litale, (3) Reriodical1y, (1)nctive, (5) Athlete (Linter 1,2,3,4 ar 5) =1 Do you have a pot? (Entor Y or n ) n Are you married? (1) Divorced, \{2\} Single, (3)Married, (1) Happiny Married (Bnter 1, 2, 3, or 4): 1 dre you a caretaker? \{Enter y or n \}: y How dn yau feel abaut yaur jab? (1) Hate it!, (2) Dislike it, (3) It's ok, (4) Enjoyable, (5) Tove it! (ELer 1, 2, 3, 4, or 5): 1 Do you cat breakfast every dry? (Bnter Y or n) : n Did either of pour biolocical parents or any ot your biolodica.1 grandparenzs die before of age 50 ? (Enter y or n) : y Do you eat fruits every day? (Enter y ar n' =rl Do you eat wedetables every day? \{inter y or n) i n Do you hand mut with yout friends? (1) Never, (2) Rericdicelly, (3)orten (Enter 1, 2 or 3): 1 What is your ecucation lenel? (1) No dedrees, (2) Highachool decree, (3) Asaociates decree, (4) Harinelors degres, (5) Mastere/ PHN drgres: (Enter 1, 2, 3, 1, or 5): 1 St.tting T,i fe Fixgrang: 60 Life Expeczency after gender: 60 Life 6xpecenty after weigit: 59 Iife Expeczanoy after amoke: 54 Lifo Expocknay after aloohol: 49 Life xpec-enty after exercise: 44 Iife Expeczancy after pet: 43 Lifo ExEoc-ancy after marricd: 38 Iife Expeciancy after caretaker: 36 Life Expecannay after jab stress: 31 Ilfe Expeczeney after breakfas:: 29 Iits Expeczeney atter died: 27 Life Expeckanzy after fruits: 22 Tife Expecannay after vegctablas: 17 Life Expec-enY aIler Irnhs: 15 Iife Expectancv arter education level: 10 Name: squidward o. Tentacles current sor: 36 SAMPLE OUTPUT 2 Enter your name: Enter your current age: 79 Nre you male or female? (Enter mor f : m What is your weight. status? (1) Jnderweight, (2) Just right, (3) overweight, (4)obese (Enter 1, 2, 3 ur 4): 1 Do you smoke digaret-es? (Enter y or n ): y Do you drink more than one alcoholic beverage every day? (Enter y or n ): y Do you exercise? (1) None, (2)very Lit:le, (3) Reriodically, (4)Active, (5) Athlete (Enter 1, 2, 3, 4 or 5): 1 Do yous have a pet.? (Fiter y or n ): n Are you married? (1) Divorce., (2) single, (3) Martied, (4) Hagpily Martind (Lnter 1, 2, 3, or 1): 1 Are you a caretaker? (Enter y or n ) : y How do you teel abouz your job? (1) Hate 1t:, \{2\}Dislike it, (3) It'g ok, (1)EnJoyable, (5) Iove 1t! (Enter 1, 2, 3,4 , or 5 ): 1 (1)Hate it:, (2) Dislake it, (3) It's ok, (4) Enjoybble, (s) Ione it! (Enter 1, 2, 3,4 , or 5): 1 Do you eat breakfast evory day? (Enter Y or n) in Did either of your biological parents or any of your biologica.1 grandparenzs die berone of age 50 ? (Enter y or n) : y Do you rat ftuits every day? (Fnter Y or n ) = Do you eat wecetables every day? \{anter y or n ) : n Do you hand out with your frionds? (1) Never, (2) Eericdicelly, (3) often (Enter 1, 2 or 3): 1 What is your eciucatiun level? (1) No degrees, (2) Highschnol degree, (3) Assaciates degree, (4) Dacielors degree, (5)Masters/PHD degree (Bnter 1, 2, 3, 4, or 5) : 1 Sterting Life Expectancy: 79 Life Expectaney after gonder: 79 Iife Expeczancy arter weiqnt: 78 tife Expecanny after smoke: 73 LiIe Expec-eriYy arler alcuivi: 60 Iife Expeczancy arter exercise: 63 tife Expecwandy after pot: 62 Life Expec-eriY afler married: 57 Life Expeciangy after caretaker: 55 Iife Expeczaney after job stress: 50 Iife Expectancy after breakfast: 48 Life Expeckanzy after died: 46 Iife Expeczaney after fruite: 41 Life Expec-ency after vegetaties: 36 Iite Expectancy atter Iriends: 34 Tife Fxpecannay nfter edurntion lewel 29 Neme: Bob Ross Cuttent. Age: 79 Life Bxgectancy: 79

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

What is an equilibrium interest-rate model? AppendixLO1

Answered: 1 week ago

Question

Does the person have her/his vita posted?

Answered: 1 week ago

Question

Discuss global cultural differences in GLOBE dimensions.

Answered: 1 week ago

Question

LO1 Discuss the objectives of human resource management.

Answered: 1 week ago