C# 6 Write a program that creates a Calculation Class Use the following Code and
ID: 3921758 • Letter: C
Question
C# 6
Write a program that creates a Calculation Class
Use the following Code and Implement as a class.
using System.IO;
using System;
class Program
{
static void Main()
{
int first, second;
Console.WriteLine("Enter first number: ");
first=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter second number: ");
second=Convert.ToInt32(Console.ReadLine());
int sum = add(first, second);
Console.WriteLine("The sum is "+sum);
}
static int add(int a, int b){
int sum = 0;
sum = a + b;
return sum;
}
}
The class will have properties for the two numbers the user inputs
The class will have methods to:
Prompt the user to input two numbers
Output results
YOU WILL NEED TO IMPLEMENT ERROR HANDLING IN CASE OF BAD INPUT!
Explanation / Answer
# include using namespace std; int main() { char o; float num1,num2; cout > o; cout > num1 >> num2; switch(o) { case '+': coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.