








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































02_variables .ppt
data type and name of the variable.
dataType variableName;
int intQty; decimal decPrice; string strName;
can be assigned to the named variable.
default value.
require that they be initialized before using them in a calculation or trying to display them.
initialized.
by assigning a value to them.
Variable Name Address (hex)^ Value
intQty A000 0
decPrice A008 0
strName A016 “null”
namespace CS
{ public class CS3Form { int cintQuantitySum; int cintSaleCount; const decimal cdecDISCOUNT_RATE = 0.15M;
private void btnCalculate_Click(…) { … class-level variables can be referenced here }
private void btnSummary_Click(…) { … class-level variables can be referenced here } }
} Docsity.com
namespace CS { public class CS3Form { int cintQuantitySum; int cintSaleCount; const decimal cdecDISCOUNT_RATE = 0.15M; private void btnCalculate_Click(…) { int intQuanity; decimal decPrice; … } private void btnSummary_Click(…) { decimal decExtended; decExtended = intQuantity * decPrice; // Error - intQuantity and decPrice not defined in procedure } } Docsity.com