Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C#, and use/create the class Calc, having private fields, public Proprieties, public Constructors (overloaded: default and with two arguments) and four

image text in transcribed

image text in transcribed

Write a program in C\#, and use/create the class Calc, having private fields, public Proprieties, public Constructors (overloaded: default and with two arguments) and four Methods to calculate and one to display the results of the four basic arithmetical operations (see the images). Create and use the Properties; use the set and get for the two entries (private class fields for the two numbers). You can use for the Methods the following signatures: public double Add(), public double Sub(), public double Mul(), public double Div(), public void Display(). For the method Display() use placeholders to display the text and the values and the results. Use In for having new lines. Create an object of the class Calc using the default Constructor, accept two numerical entries form the user (use try and catch) in Main(), and then store the entered values using the Proprieties, calculate and display the results similar like in the images. Create the second object in Main() by using the second Constructor (with two arguments) this time by passing as parameters the values 9 and 3, then call again the method to display the results. Here are the screen shots of testing the application: EA Ci,UsersimihainDownloadsiC=1.7038,ConsoleApp3.3CalciConsoleApp3.3Calcibin'Debuglunetcorespp3. ThConsoleApp3.3Calc.ere Default Constructor using default values please enter the first number: 86 . please enter the second number: 20 Your numbers are:8e \& 20 89+26=19 88/2=162=4 Constructor with two arguments for number 1=9 and number2-3 (private variables), using Proprieties (set=write; get=read) Number 1=9 and Number 2=3 Your numbers are:9 \& 3 9+993=123=63=27 99/3=273=3 Default Constructor using default values number 1=, number2-e, res-e, info-( NaN = not a number ) Please enter the first number: Please enter the second number: 6 please enter the second number: 2 Your numbers are: \& 2 using Proprieties (set=write; get-read) Number1-9 and Number2-3 rour numbers are:9 83 With entered values abc, then 4 and test, then 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions