Project [2]: Expressions and Operators
Project Goals
The goal of this project is to:
1. Get students familiar with expressions and operators.
Important Notes:
1. Formatting: Make sure that you follow the preciserecommendations for the output content and formatting. For example,do not change the text from
“You’re walking through the woods and come upon a chest.
Do you open it? 1 – yes 2 - no†to
“Do you open the chest? â€.
Your assignment will be auto-graded and any changes in formattingwill result in a loss in the grade.
2. Comments: Header comments are required on all files andrecommended for the rest of the program. Points will be deducted ifno header comments are included.
Program
Save your program as adventure.c
Write a program that will allow the user to play a simple ChooseYour Own Adventure game.
The program should behave as follows:
The user starts out with 10 Health Points and 0.0 Wealth Points.The user encounters a series of choices which affect their Healthand Wealth Point totals. In the end, if their Health Points areover 10 and their Wealth Points are over 4.25, they win! Otherwisethey lose.
The first choice comes when the user encounters a chest. If theyopen the chest, they gain 3.75 Wealth Points and a sword. If theydon’t, they stub their toe and lose a Health Point.
The second choice comes when the user encounters a bag. If theyopen the bag, they gain 5.15 Wealth Points and a shield. If theydon’t, they get a blister and lose a Health Point.
The final choice is whether to engage in a battle with an ogre. Ifthey choose to fight and they don’t have a sword or shield, theylose all their Health Points. If they choose to fight and they haveonly the sword, they lose all their Health Points. If they chooseto fight and they have only the shield, they don’t lose or gain anyHealth Points. If they choose to fight and have both their swordand shield, they gain 12 Health Points. If they choose to flee,they trip and fall, get stomped on by the ogre and lose all theirHealth Points.