Which two actions should you perform?

You create Microsoft Windows-based applications. You are reviewing code for an application that is created for a bank. You find that a Microsoft Windows Form includes the following code segment.

public partial class ATMDeposit : Form {
private BankAccount account;
public ATMDeposit() {
InitializeComponent();
}
private void ATMDeposit_Load(object sender, EventArgs e) { account = new BankAccount();
}
private void cmdDeposit_Click(object sender, EventArgs e) { account.Deposit(decimal.Parse(txtAmount.Text));
}
}

You analyze the code segment and find that the form handles no other events. You need to suggest changes to improve reliability. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

You create Microsoft Windows-based applications. You are reviewing code for an application that is created for a bank. You find that a Microsoft Windows Form includes the following code segment.

public partial class ATMDeposit : Form {
private BankAccount account;
public ATMDeposit() {
InitializeComponent();
}
private void ATMDeposit_Load(object sender, EventArgs e) { account = new BankAccount();
}
private void cmdDeposit_Click(object sender, EventArgs e) { account.Deposit(decimal.Parse(txtAmount.Text));
}
}

You analyze the code segment and find that the form handles no other events. You need to suggest changes to improve reliability. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.
Add an event handler for the TextChanged event for the txtAmount textbox to validate the data typed by the user.

B.
Add an event handler for the Validating event for the txtAmount textbox to validate the data typed by the user.

C.
Add a Try…Catch block to the cmdDeposit_Click method.

D.
Add a Try…Catch block to the ATMDeposit_Load method.

E.
Add a Try…Catch block to the ATMDeposit constructor.



Leave a Reply 0

Your email address will not be published. Required fields are marked *