Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Class/Object: Variables: x, y, z Range: 1-20 Functions: F2 x*y - z Hint : sum x

ID: 3743308 • Letter: C

Question

Class/Object: Variables: x, y, z Range: 1-20 Functions: F2 x*y - z Hint : sum x ty+z, so F1 and F2 are some variations of sum function. Buttons: Set , Get, F1, F2

Explanation / Answer

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ThreeNumber { class Numbers { private double x, y, z; public double X { get { return x; } set { if(value < 1) { x = 1; } else if(value > 20) { x = 20; } else { x = value; } } } public double Y { get { return y; } set { if (value < 1) { y = 1; } else if (value > 20) { y = 20; } else { y = value; } } } public double Z { get { return z; } set { if (value < 1) { z = 1; } else if (value > 20) { z = 20; } else { z = value; } } } public double F1() { return x * 2 + y * x - z * z; } public double F2() { return x * y - z; } } class Program { static void Main(string[] args) { Numbers nums = new Numbers(); nums.X = 5; nums.Y = 2; nums.Z = 8; Console.WriteLine("F1 = " + nums.F1().ToString()); Console.WriteLine("F2 = " + nums.F2().ToString()); } } }