Lab4_F09 - 6 Challenge problem Extra credit Modify the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 101: Fundamentals of Computer Programming Lab 4: Using If statements in C++ Programs 1) Open Lab4B.cpp and look over the program, read the comments to understand what the program is supposed to do. Compile and run Lab4B.cpp, test it to make sure it works. Use ‘D’ for gender, what happened? 2) Run the program again, this time enter either ‘m’ or ‘f’, what happened? Then enter -4 for age. What happened this time? 3) Run the program again and enter either ‘m’ or ‘f’ for gender and 22 for age. What is printed? 4) Repeat the process several times and try different values to make sure all parts of the program work and provide the appropriate message. 5) Modify the program to increase the age limit to 85, and add 2 more branches to multi-alternative if statement to include a message for people between ages of 55 and 61 to indicate “Get ready for retirement.” And another message for people between ages of 61 and 85 to sat “You did it, enjoy retirement.”
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6) Challenge problem, Extra credit. Modify the program to read the data and use one multi-alternative if statement instead of the 3 if statements and only include 1 return statement at the end instead of 3 in the existing program. 7) Open the program you developed for last week lab and change the algorithm and the program so it would verify the inputted scores and if any of the scores are outside of 0-100 range print an error message and stop the program. 8) Modify the algorithm and the program so a letter grade is assigned to the student based on their average and print the assigned grade as part of your output. Use the following table to assign letter grade: 90 -- 100 A 80 -- 89.99 B 70 -- 79.99 C 60 -- 69.99 D 0 -- 59.99 F 10) Congratulations, you are done. Have your TA check out your work to get credit....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online