forked from truecodersio/MethodsExercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
63 lines (53 loc) · 1.61 KB
/
Program.cs
File metadata and controls
63 lines (53 loc) · 1.61 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
using System.Xml.Linq;
namespace MethodsExercise
{
public class Mathamatics
{
public int Sum(int[] args)
{
int sum = 0;
foreach (int number in args) {
sum += number;
}
return sum;
}
public int Subtract(int one, int two)
{
return one - two;
}
public int Multiply(int one, int two)
{
return one * two;
}
public double Devide(int one, int two)
{
return (double)one / two;
}
}
public class Program
{
static void Story()
{
Console.WriteLine("Enter your name!");
string? name = Console.ReadLine();
Console.WriteLine("Enter your dogs name!");
string? dog = Console.ReadLine();
Console.WriteLine($"{name} has a really cute dog named {dog} however my dog Ozzy is cuter (Picture provided in source code for proof)");
}
static void Main(string[] args)
{
// Show the math
Mathamatics math = new Mathamatics();
int sum = math.Sum(new int[] { 1, 2, 3, 4 });
Console.WriteLine($"sum: {sum}");
int sub = math.Subtract(1,3);
Console.WriteLine($"subtract: {sub}");
int quotent = math.Multiply(2, 4);
Console.WriteLine($"multiply: {quotent}");
double dontKnowTheWord = math.Devide(3, 2);
Console.WriteLine($"devide: {dontKnowTheWord}\n");
// Do the story
Story();
}
}
}