Answered step by step
Verified Expert Solution
Link Copied!

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 btnComputeCost_Click(object 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 btnDisplay_Click(object sender, EventArgs e)
{
lstDisplay.Items.Add(subTotal.ToString());
}
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 btnComputeCost_Click(object 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 btnDisplay_Click(object sender, EventArgs e)
{
lstDisplay.Items.Add(subTotal.ToString());
}
The following statement is true about the variable subTotal:
A. the statement that displays subTotal within lstDisplay_Click is invalid because the variable subTotal cannot be accessed from lstDisplay_Click method.
B. subTotal can be accessed from any statement (before or after its declaration) within the method, btnComputeCost_Click
C. subTotal can be accessed only from statements that follow its declaration within the method, btnComputeCost_Click
both A and C are true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions