1. Sample Run 1 Amazing Combat Calculator v1 Enter ability name: Slap Enter base damage: 200.25 Enter ability category: N Slap dealt 240.3 boring normal damage to the target Sample Run 2 Amazing Combat Calculator vi Enter ability name: Rest Enter base damage: 100 Enter ability category: H Rest dealt -100.0 damage healing the target. 3. Sample Run 3 Amazing Combat Calculator v1 Enter ability name: FrostFire Enter base damage: 7777.77 Enter ability category: A FrostFire dealt 1944.4 area of effect damage to each targe 4. Sample Run 4 Amazing Combat Calculator v1 Enter ability name: Tomato Toss Enter base damage: 900 Enter ability category: N Ability Tomato Toss not implemented yet. 5. Sample Run 5 Amazing Combat Calculator v1 Enter ability name: Tomato Toss Enter base damage: -1 Enter ability category: H Ability Tomato Toss not implemented yet. 6. Sample Run 6 - Amazing Combat Calculator v1 Enter ability name : Rest Enter base damage: 9001 Enter ability category: H Only Goku can deal more than 9000 dmg. 7. Sample Run 7 Amazing Combat Calculator v1 Enter ability name: Slap Enter base damage: -10 Enter ability category: N All ability damage must be positive.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hello I'm working on a combat calculator prototype in C++. I'm a bit lost on what to do next.

 

Program Requirements:

  • There are three valid abilities represented by the following string literals:

    1. "Rest"
    2. "Slap"
    3. "FrostFire"
  • If the ability entered is not one of the valid abilities, the program should output the invalid name entered and indicate the ability has not been implemented yet.

  • Ability names are case sensitive. "rest" should fail while "Rest" would not.

  • The base damage must be a positive numeric value no larger than 9000.

    1. Floating point values are allowed.
    2. 0 will be considered negative.
  • If the base damage entered is not positive or is larger than 9000, an error message should be printed out indicating what the problem is.

    1. A base damage of 0 or lower should output All ability damage must be positive.
    2. A base damage of over 9000 should output Only Goku can deal more than 9000 dmg.
  • There are three valid ability categories and these categories determine how the damage will be calculated.

    1. "A" - 'A' is for area of effect abilities. Their damage should be calculated by dividing the base damage by 4.
    2. "N" - 'N' is for normal ability. The damage should be calculated by multiplying the base damage by the value 1.2
    3. "H" - 'H' is for healing. So the damage dealt should be converted to a negative number.
  • If an invalid category is entered and all other values are valid, you should output the message Ability category X not implemented. where X is whatever the user entered for the category. If the user had typed "Potato" Then the message should say, Ability category Potato not implemented.

  • Use a switch statement to handle the ability category decision.

  • You may assume the user will input strings when asked and numeric values when asked. So, you do not need to handle program crashes due to someone typing a "word" for damage.

  • You may assume any combination of valid abilities and categories works even though they may not make sense. I.e. the inputs "Slap" "300.24" and "H" would Slap to heal the target even though it makes no sense.

  • Ensure that all numeric output always displays 1 decimal place.

  • When determining output error messages. Ability existence takes priority, then damage being in range, then category. I.e. If all values are invalid only the ability error message appears. If the ability is valid and both damage and category are invalid, only the damage message appears. If only the category is invalid, then we will see the error message for it.

1. Sample Run 1
Amazing Combat Calculator v1
Enter ability name: Slap
Enter base damage: 200.25
Enter ability category: N
Slap dealt 240.3 boring normal damage to the target
2. Sample Run 2
Amazing Combat Calculator v1
Enter ability name: Rest
Enter base damage: 100
Enter ability category: H
Rest dealt -100.0 damage healing the target.
3. Sample Run 3
Amazing Combat Calculator v1
Enter ability name: FrostFire
Enter base damage: 7777.77
Enter ability category: A
FrostFire dealt 1944.4 area of effect damage to each targe
4. Sample Run 4
Amazing Combat Calculator v1
Enter ability name: Tomato Toss
Enter base damage: 900
Enter ability category: N
Ability Tomato Toss not implemented yet.
5. Sample Run 5
Amazing Combat Calculator v1
Enter ability name: Tomato Toss
Enter base damage: -1
Enter ability category: H
Ability Tomato Toss not implemented yet.
6. Sample Run 6
Amazing Combat Calculator v1
Enter ability name: Rest
Enter base damage: 9001
Enter ability category: H
Only Goku can deal more than 9000 dmg.
7. Sample Run 7
Amazing Combat Calculator v1
Enter ability name: Slap
Enter base damage: -10
Enter ability category: N
All ability damage must be positive.
Transcribed Image Text:1. Sample Run 1 Amazing Combat Calculator v1 Enter ability name: Slap Enter base damage: 200.25 Enter ability category: N Slap dealt 240.3 boring normal damage to the target 2. Sample Run 2 Amazing Combat Calculator v1 Enter ability name: Rest Enter base damage: 100 Enter ability category: H Rest dealt -100.0 damage healing the target. 3. Sample Run 3 Amazing Combat Calculator v1 Enter ability name: FrostFire Enter base damage: 7777.77 Enter ability category: A FrostFire dealt 1944.4 area of effect damage to each targe 4. Sample Run 4 Amazing Combat Calculator v1 Enter ability name: Tomato Toss Enter base damage: 900 Enter ability category: N Ability Tomato Toss not implemented yet. 5. Sample Run 5 Amazing Combat Calculator v1 Enter ability name: Tomato Toss Enter base damage: -1 Enter ability category: H Ability Tomato Toss not implemented yet. 6. Sample Run 6 Amazing Combat Calculator v1 Enter ability name: Rest Enter base damage: 9001 Enter ability category: H Only Goku can deal more than 9000 dmg. 7. Sample Run 7 Amazing Combat Calculator v1 Enter ability name: Slap Enter base damage: -10 Enter ability category: N All ability damage must be positive.
0 #include <fstream>
7 #include <iomanip>
8 #include <iostream>
#include <string>
9
10
11
12
13
14
15
959927NANAANGAAN MAA
10
17
18
19
20
21
22
23
24
20
28
30
31
32
33
39
40
41
int main() {
bool
42
43 →
44
34 std::cout<<"Enter base damage: ";
std::cin>> damage;
35
45
40
47
48
49
std::cout << std::fixed << std::setprecision (2);
std::string name;
float damage;
std::string category;
std::string Rest;
std::string Slap;
std::string FrostFire;
30
37 std::cout<<"Enter ability category: ";
38
std::cin>> category;
float A= (damage / 4);
float N= (damage * 1.2);
float H= (damage / (-1));
50
51
52
53
54
55 }
// Prompt user to ask questions
std::cout << "Enter ability name: ";
std::cin>> name;
// answer = get_answer();
std::string
if (damage <= 0) {
std::cout << damage << "All ability damage must be positive";
}
else if (damage > 9000) {
std::cout << damage << "Only Goku can deal more than 9000 dmg";
}
if (category= A) {
std::cout <<
}
std::cout << '\n' << name << dealt " << damage << damage to target\n";
Transcribed Image Text:0 #include <fstream> 7 #include <iomanip> 8 #include <iostream> #include <string> 9 10 11 12 13 14 15 959927NANAANGAAN MAA 10 17 18 19 20 21 22 23 24 20 28 30 31 32 33 39 40 41 int main() { bool 42 43 → 44 34 std::cout<<"Enter base damage: "; std::cin>> damage; 35 45 40 47 48 49 std::cout << std::fixed << std::setprecision (2); std::string name; float damage; std::string category; std::string Rest; std::string Slap; std::string FrostFire; 30 37 std::cout<<"Enter ability category: "; 38 std::cin>> category; float A= (damage / 4); float N= (damage * 1.2); float H= (damage / (-1)); 50 51 52 53 54 55 } // Prompt user to ask questions std::cout << "Enter ability name: "; std::cin>> name; // answer = get_answer(); std::string if (damage <= 0) { std::cout << damage << "All ability damage must be positive"; } else if (damage > 9000) { std::cout << damage << "Only Goku can deal more than 9000 dmg"; } if (category= A) { std::cout << } std::cout << '\n' << name << dealt " << damage << damage to target\n";
Expert Solution
steps

Step by step

Solved in 4 steps with 9 images

Blurred answer
Knowledge Booster
Development strategies
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education