Project [2]: Expressions and Operators Project Goals The goal of this project is to: 1. Get students familiar...

80.2K

Verified Solution

Question

Programming

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.

Answer & Explanation Solved by verified expert
4.3 Ratings (679 Votes)
Online C Compiler Code Compile Run and Debug C program online Write your code in this editor and press Run button to compile and execute it include int main store points in varible int HealthPoint10 float WealthPoint000 take accept input int input boolean for checking conditions int havesword0 int haveshield0 printfYoure walking through the woods and come upon a chest Do you open it 1 yes 2 no scanfdinput ifinput 1    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students