+ 1

Help with solution to problem (C#, properties)

I have got stuck on an exercise while learning properties. the problem is this: Properties You are creating our payment application. The maximum payment it can make at one time is 50000. The program you are given takes the payment value as input. Complete the provided property to take the payment, assign it to appropriate class member, and output "Accepted" if the payment isn't greater than 50000. If it is, the property should output "Error." Sample Input 15000 Sample Output Accepted And the starter code is this: namespace SoloLearn { class Program { static void Main(string[] args) { int pay = Convert.ToInt32(Console.ReadLine()); Payment pay1 = new Payment(); pay1.PaymentValue = pay; } } class Payment { private int paymentValue; //complete the property public int PaymentValue { get {} set { } } } } I have no idea how to solve this. Can anyone point me in the right direction?

16th Jul 2021, 7:21 AM
Tomas Weiskog
Tomas Weiskog - avatar
1 Respuesta
30th Jul 2021, 6:38 PM
Artem