-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
52 lines (50 loc) · 2.05 KB
/
Copy pathProgram.cs
File metadata and controls
52 lines (50 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
namespace Else_if_Enemies_Defeated
{
class Program
{
static void Main(string[] args)
{
string playerName = "Gulram Stonebeard";
int defeatedEnemies = 1;
int points = 0;
int bonusPoints = 0;
int totalPoints = 0;
if (defeatedEnemies == 100)
{
points = 100;
bonusPoints = (int)(points * .2);
totalPoints = points + bonusPoints;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"Congratulations, {playerName}! You defeated all the enemies! You receive {points} points and a bonus of {bonusPoints} points, for a total of {totalPoints} points!");
Console.ResetColor();
}
else if (defeatedEnemies >= 75 && defeatedEnemies <= 99)
{
points = 81;
bonusPoints = (int)(points * .05);
totalPoints = points + bonusPoints;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"Congratulations, {playerName}! You defeated many enemies! You receive {points} points and a bonus of {bonusPoints} points, for a total of {totalPoints} points!");
Console.ResetColor();
}
else if(defeatedEnemies >= 50 && defeatedEnemies <= 74)
{
points = 64;
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine($"Congratulations, {playerName}! You defeated some enemies! You receive {points} points!");
Console.ResetColor();
}
else if (defeatedEnemies >= 0 && defeatedEnemies <= 49)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Sorry, {playerName}, you were defeated.");
Console.ResetColor();
}
else
{
Console.WriteLine("Error. Invalid amount");
}
}
}
}