-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adicionar exercícios resolvidos da aula 01
- Loading branch information
1 parent
e0e7111
commit af5a726
Showing
26 changed files
with
1,368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26124.0 | ||
MinimumVisualStudioVersion = 15.0.26124.0 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercicio3", "Exercicio3\Exercicio3.csproj", "{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercicio4", "Exercicio4\Exercicio4.csproj", "{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercicio5", "Exercicio5\Exercicio5.csproj", "{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercicio6", "Exercicio6\Exercicio6.csproj", "{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercicio7", "Exercicio7\Exercicio7.csproj", "{DCD0498B-13C4-4675-98CF-836E39F81444}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Debug|x64.Build.0 = Debug|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Debug|x86.Build.0 = Debug|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Release|x64.ActiveCfg = Release|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Release|x64.Build.0 = Release|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Release|x86.ActiveCfg = Release|Any CPU | ||
{5CE8ADF9-A68E-41A1-B1BE-D6A8B7F5C4B7}.Release|x86.Build.0 = Release|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Debug|x64.Build.0 = Debug|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Debug|x86.Build.0 = Debug|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Release|x64.ActiveCfg = Release|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Release|x64.Build.0 = Release|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Release|x86.ActiveCfg = Release|Any CPU | ||
{D5E202C2-B8CE-43E8-884E-D52B06FCD7A4}.Release|x86.Build.0 = Release|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Debug|x64.Build.0 = Debug|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Debug|x86.Build.0 = Debug|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Release|x64.ActiveCfg = Release|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Release|x64.Build.0 = Release|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Release|x86.ActiveCfg = Release|Any CPU | ||
{D48AC11B-943F-47C5-A1E7-C3748C79D0E9}.Release|x86.Build.0 = Release|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Debug|x64.Build.0 = Debug|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Debug|x86.Build.0 = Debug|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Release|x64.ActiveCfg = Release|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Release|x64.Build.0 = Release|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Release|x86.ActiveCfg = Release|Any CPU | ||
{8AE5D9C6-6556-4F9F-A317-3992C96F59B7}.Release|x86.Build.0 = Release|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Debug|x64.Build.0 = Debug|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Debug|x86.Build.0 = Debug|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Release|x64.ActiveCfg = Release|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Release|x64.Build.0 = Release|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Release|x86.ActiveCfg = Release|Any CPU | ||
{DCD0498B-13C4-4675-98CF-836E39F81444}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
|
||
namespace Exercicio3 | ||
{ | ||
public class Cat | ||
{ | ||
// ////////////////////////////////////////////////////////// // | ||
// Estado do gato, definido pelas suas variáveis de instância // | ||
// ////////////////////////////////////////////////////////// // | ||
|
||
// Nome | ||
private readonly string name; | ||
|
||
// Energia, entre 0 e 100 | ||
private int energy; | ||
|
||
// Nível de alimentação | ||
private Feed feedStatus; | ||
|
||
// Disposição do gato | ||
private Mood moodStatus; | ||
|
||
// /////////////////////////////////////////// // | ||
// Ações do gato, definidas pelos seus métodos // | ||
// /////////////////////////////////////////// // | ||
|
||
// Comer | ||
public void Eat() | ||
{ | ||
// Aumentar estado de alimentação do gato apenas se o mesmo não | ||
// estiver prestes a explodir | ||
if (feedStatus < Feed.AboutToExplode) | ||
{ | ||
feedStatus++; | ||
} | ||
} | ||
|
||
// Dormir | ||
public void Sleep() | ||
{ | ||
// Aumentar a energia do gato ao dormir, garantindo que a mesma não | ||
// passa dos 100 | ||
energy += 20; | ||
if (energy > 100) energy = 100; | ||
|
||
// Gato fica com mais fome do que tinha dantes (a não ser que já | ||
// estivesse esfomeado) | ||
if (feedStatus > Feed.Starving) | ||
{ | ||
feedStatus--; | ||
} | ||
|
||
// A disposição do gato ao acordar é rabugento | ||
// Seria mais interessante ser aleatória, veremos no próximo | ||
// exercício | ||
moodStatus = Mood.Grumpy; | ||
} | ||
|
||
// Brincar | ||
public void Play() | ||
{ | ||
// Gato perde energia ao brincar, mas não pode ficar menor que zero | ||
energy -= 15; | ||
if (energy < 0) energy = 0; | ||
|
||
// Gato fica feliz ao brincar | ||
moodStatus = Mood.Happy; | ||
} | ||
|
||
// Miar | ||
public void Meow() | ||
{ | ||
// Gato mia na consola. E se quiséssemos reutilizar esta classe no | ||
// Unity, como faríamos? | ||
Console.WriteLine("Meow!"); | ||
|
||
// Gato perde energia ao miar, mas não pode ficar menor que zero | ||
energy -= 5; | ||
if (energy < 0) energy = 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<LangVersion>8.0</LangVersion> | ||
</PropertyGroup> | ||
|
||
</Project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Exercicio3 | ||
{ | ||
public enum Feed | ||
{ | ||
Starving, | ||
Hungry, | ||
Satisfied, | ||
Full, | ||
AboutToExplode | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Exercicio3 | ||
{ | ||
public enum Mood | ||
{ | ||
Happy, | ||
Grumpy, | ||
IgnoringYou, | ||
HyperActive | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace Exercicio3 | ||
{ | ||
public class Program | ||
{ | ||
private static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Hello World!"); | ||
} | ||
} | ||
} |
Oops, something went wrong.