Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a program in c# with following properties and methods Assignment 1-Rational Properties: You must use auto-implemented properties The retters are public, and the settirare
write a program in c# with following properties and methods
Assignment 1-Rational Properties: You must use auto-implemented properties The retters are public, and the settirare private S1 Denominator this auto implemented property is an integer representing the bottom of the rational number. The better is public and the setter is private COS 2 Numerator--this auto-implemented property is an integer representing the top of the rational number. The getter is public and the setter is private Constructor: 1. public Rational (int numerator = 0, int denominator = 1) - This is the public constructer. It takes two parameters: integers representing the numerator (detaute is ) and the denominator (default is 1). The method assigns the two arguments to the appropriate fields. Methods 1. public override string ToString() - This method overrides the same method of the object class. It does not take any parameter but return a string representation of itself. You decide on the format for the output 2. public void IncreaseBy(rational other) - This is a public method that takes an argument of type Rational. It adds the argument to the current object. This method does not output anything to the green, return value nor does it mutate (change) the argument 3. public void DecreaseBy(Rational other) - This is a public method that takes an argument of type Rational. It subtracts the argument from the current object. This method does not output anything to the screen, return a value nor does it mutate or change the argument. In your test harness do the following Your output should make sense. You should display the twoitational before the operation inform the user what kind of operation will be done, do the operation and then display the fraction after the operation Create a loob.ects using 0, 1 and 2 arguments. Try to use named argumenta in the last instantiation, Select two pairs of the above cbject print them, then all the increasedy (tation method and print the objects again Select another two pair of the above osts print them then call the Decres Sedeya method and in the sector Compare your output so that the user will be able to unde pening Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started