-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
121 lines (104 loc) · 3.42 KB
/
Program.cs
File metadata and controls
121 lines (104 loc) · 3.42 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
// See https://aka.ms/new-console-template for more information
using System;
using System.ComponentModel;
namespace MyFirstCalculator
{
class MyFirstCalculator
{
private double data1;
private double data2;
private double add;
private double sub;
private double div;
private double mult;
private double mod;
public void EnterData(double data1new, double data2new)
{
data1 = data1new;
data2 = data2new;
}
public double Addition()
{
return add = data1 + data2;
}
public double Subtration()
{
return sub = data1 - data2;
}
public double Multiplicatin()
{
return mult = data1 * data2;
}
public double Division()
{
return div = data1 / data2;
}
public double Modulus()
{
return mod = mult / 2;
}
public void ComputeAddition()
{
Console.WriteLine("results {0}", Addition());
}
public void ComputeSubtration()
{
Console.WriteLine("results {0}", Subtration());
}
public void ComputeMultiplicatin()
{
Console.WriteLine("results {0}", Multiplicatin());
}
public void ComputeDivision()
{
Console.WriteLine("results {0}", Division());
}
public void ComputeModulus()
{
Console.WriteLine("results {0}", Modulus());
}
}
/*this is here for you*/
/*Test Change*/
class Calculator
{
static void Main(string[] args)
{
MyFirstCalculator calculate = new MyFirstCalculator();
{
Console.WriteLine("\nSelect an operation:");
Console.WriteLine(">> Addition (+)");
Console.WriteLine(">> Subtraction (-)");
Console.WriteLine(">> Multiplication (*)");
Console.WriteLine(">> Division (/)");
Console.Write("\nEnter your choice >> ");
string choice = Convert.ToString(Console.ReadLine());
Console.WriteLine("enter the first number: ");
double data1new = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("enter the second number:");
double data2new = Convert.ToDouble(Console.ReadLine());
switch (choice){
case "Addition":
calculate.EnterData(data1new, data2new);
calculate.ComputeAddition();
break;
case "Subtraction":
calculate.EnterData(data1new, data2new);
calculate.ComputeSubtration();
break;
case "Multiplication":
calculate.EnterData(data1new, data2new);
calculate.ComputeMultiplicatin();
break;
case "Division":
calculate.EnterData(data1new, data2new);
calculate.ComputeDivision();
break;
default:
Console.WriteLine("Invalid choice!");
break;
}
}
}
}
}