Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider a form that has two buttons: btnComputeCost: computes the sub total and total cost for an order. btnDisplay: intended to display the sub total
Consider a form that has two buttons:
btnComputeCost: computes the sub total and total cost for an order.
btnDisplay: intended to display the sub total in a ListBox named lstDisplay.
The click event handlers of the two buttons look as follows:
private void btnComputeCostClickobject sender EventArgs e
statements to declare and assign values to unitPrice and number of
scoops go here
double subTotal;
subTotal unitPrice scoops;
statements to compute total cost go here
private void btnDisplayClickobject sender EventArgs e
lstDisplay.Items.AddsubTotalToString;
The following statement is true about the variable subTotal:
Consider a form that has two buttons:
btnComputeCost: computes the sub total and total cost for an order.
btnDisplay: intended to display the sub total in a ListBox named lstDisplay.
The click event handlers of the two buttons look as follows:
private void btnComputeCostClickobject sender EventArgs e
statements to declare and assign values to unitPrice and number of
scoops go here
double subTotal;
subTotal unitPrice scoops;
statements to compute total cost go here
private void btnDisplayClickobject sender EventArgs e
lstDisplay.Items.AddsubTotalToString;
The following statement is true about the variable subTotal:
A the statement that displays subTotal within lstDisplayClick is invalid because the variable subTotal cannot be accessed from lstDisplayClick method.
B subTotal can be accessed from any statement before or after its declaration within the method, btnComputeCostClick
C subTotal can be accessed only from statements that follow its declaration within the method, btnComputeCostClick
both A and C are true
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