-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
221 lines (191 loc) · 6.32 KB
/
Program.cs
File metadata and controls
221 lines (191 loc) · 6.32 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
using System;
// this was created by ZACHARY CRAIG
namespace PCE_StarterProject
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello Everyone and welcome to another Five nights at Freddy's episode, Today we are gonna become THE KING OF FIVE NIGHTS AT FREDDY's");
Conditional_Statements cs = new Conditional_Statements();
cs.RunExercise();
Comparison_Operators co = new Comparison_Operators();
co.RunExercise();
IO_Operators ioo = new IO_Operators();
ioo.RunExercise();
Integer_Vs_Real_Division ivrd = new Integer_Vs_Real_Division();
ivrd.RunExercise();
// Clearly, you will need to uncomment these to test them...
Modulus_Operator mo = new Modulus_Operator();
mo.RunExercise();
Fahrenheit_To_Celsius ftc = new Fahrenheit_To_Celsius();
ftc.RunExercise();
}
}
class Conditional_Statements
{
public void RunExercise()
{
Console.WriteLine("About to do the \"Conditional Statements\" exercise");
Conditional_Methods cm = new Conditional_Methods();
cm.UsingIf();
cm.UsingIfElse();
cm.UsingSwitch();
}
}
class Comparison_Operators
{
public void RunExercise()
{
// Console.WriteLine("Get 2 integers & store them, then compare them using <, <=, etc, etc");
Console.WriteLine("please input a number");
int numOne = 0;
string input1 = "";
input1 = Console.ReadLine();
Int32.TryParse(input1,out numOne);
Console.WriteLine("please input a second number");
int numTwo = 0;
string input2 = "";
input2 = Console.ReadLine();
Int32.TryParse(input2, out numTwo);
if ((numOne - numTwo <=5 && numOne - numTwo >= 0 )|| (numTwo - numOne <= 5 && numTwo - numOne >= 0))
{
Console.WriteLine("both inputs are within 5 integers of each other");
}
else
{
Console.WriteLine("The inputs are not within 5 integers of each other");
}
}
}
class IO_Operators
{
public void RunExercise()
{
}
}
class Conditional_Methods
{
public void UsingIf()
{
Console.WriteLine("please input a number");
int x = 0;
string szInput;
szInput = Console.ReadLine();
if (Int32.TryParse(szInput, out x) == true)
{
Console.WriteLine("The number you typed is: {0}", x);
}
}
public void UsingIfElse()
{
Console.WriteLine("please input a number");
int x = 0;
string szInput;
szInput = Console.ReadLine();
if (Int32.TryParse(szInput, out x) == true)
{
Console.WriteLine("The number you typed is: {0}", x);
}
else
{
Console.WriteLine("You failed to type a number");
}
}
public void UsingSwitch()
{
Console.WriteLine("please input a number");
int x = 0;
string szInput;
szInput = Console.ReadLine();
switch (Int32.TryParse(szInput, out x))
{
case true:
Console.WriteLine("You wrote {0}",x);
break;
default:
Console.WriteLine("Input a valid NUMBER!!!");
break;
}
}
}
class Integer_Vs_Real_Division
{
public void RunExercise()
{
int x = 6;
int y = 3;
int z = x / y;
Console.WriteLine(z);
int a = 7;
int c = 3;
double b = a / c;
Console.WriteLine(b);
float e = 7f / 3f;
Console.WriteLine(e);
float j = 6f / 3f;
Console.WriteLine(j);
double f = 6;
double g = 3;
double k = f / g;
Console.WriteLine(k);
double h = 7;
double i = 3;
double l = h / i;
Console.WriteLine(l);
//floats and doubles can be used for decimal expressions floats are 32bit and double is 64 bit floats wont hold thus floats are for smaller expressions but you should end your number with an f
}
}
class Modulus_Operator
{
public void RunExercise()
{
int x = 10;
int y = 3;
int z = x / y;
Console.WriteLine(z);
Console.WriteLine(x % y);
Console.WriteLine("please input a number");
int numOne = 0;
string input1 = "";
input1 = Console.ReadLine();
Int32.TryParse(input1, out numOne);
Console.WriteLine("please input a second number");
int numTwo = 0;
string input2 = "";
input2 = Console.ReadLine();
Int32.TryParse(input2, out numTwo);
int outPut = numOne / numTwo;
Console.WriteLine("Your output is" + outPut);
Console.WriteLine("And the Mod for this is" + (numOne % numTwo));
}
}
class Fahrenheit_To_Celsius
{
public void RunExercise()
{
int Fahrenheit = 0;
Console.WriteLine("Please input a Fahrenheit number that will be converted to celsius");
string input1 ="";
input1 = Console.ReadLine();
Int32.TryParse(input1, out Fahrenheit);
int Celsius = (5 / 9) * (Fahrenheit - 32);
Console.WriteLine("Congrats your calculation is" + Celsius + "degrees Celsius");
}
}
class Logical_Operators
{
// Your answer goes here,in a comment like this one
//1. true y is > 1
//2. false
//3. true z is > than 8
//4. false z is > 8
//5. false zis > and y is < 3
//6.false
//7. true
//8. true
//9. false
//10.false
// Side-Note: Notice that this class has NO methods, and that it still compiles :)
}
}