0
Help, Has the payment been accepted? Get and Set - If Else
I need help with the output of the code in the If Else statement in the Set property. This is the description of the exercise: You are creating our payment request. The maximum payment you can make in one go is 50,000. The program that you are given takes the payment value as input. Populate the property provided to take the payment, assign it to the appropriate class member, and generate "Accepted" if the payment is not greater than 50000. If it is, the property should generate "Error." Input example 15000 Output example Accepted. Use the if else condition inside the set accessor to handle the check. https://code.sololearn.com/cnH7kGeXRRo1/?ref=app
4 Answers
+ 4
Alex NarvĂĄez
You missed to add this line in set before the if condition.
paymentValue = value;
Write before if condition
----------Setter----------
set
{
paymentValue = value;
if(paymentValue <= 50000) {
Console.Write("Accepted");
} else {
Console.Write("Error");
}
}
+ 2
Alex NarvĂĄez
paymentValue should be <= 50000
maximum payment is 50000 so it should be either less than or equal to 50000
+ 2
Thank you very much for your answer, however I already changed it and the output error persists. There is something else wrong with the Set property in the If else statement
+ 1
Excellent! thank you very much for your help. She had forgotten that detail. I appreciate your time and availability to help me. I am very grateful