






























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!































04_decisions.ppt
executed.
//output txtSubtotal.Text = decSubtotal.ToString(“N”);
Begin
Input price, qty
subtotal = price * qty
Output subtotal
End
Subtotal = qty * price
If taxable
Sales tax = subtotal * Tax Rate
True
False
Output sales tax
if (radNextDay.Checked == true) decShipping = cdecNEXT_DAY_SHIPPING_RATE;
else decShipping = cdecTHREE_DAY_SHIPPING_RATE;
if (condition)
true – 1 or more statements
else
false – 1 or more statements
Block of code – Compound Statements
if (intHours > 40) { decRegularPay = 40 * decPayRate; decOvertimePay = (intHours – 40) * (decPayRate * cdec_OVERTIME_RATE); } else { decRegularPay = intHours * decPayRate; decOvertimePay = 0; } decGrossPay = decRegularPay + decOvertimePay;
if (intQuantity >= 1) if (decPrice >= 5.00M) decSubtotal = intQty * decPrice; else { MessageBox.Show(“Invalid price entered”); txtPrice.Focus(); txtPrice.SelectAll(); } else { MessageBox.Show(“Invalid quantity entered”); txtQuantity.Focus(); txtQuantity.SelectAll(); }
= = ! = <
< =
=
Equal to Not Equal to Less than Greater than Less than or equal to Greater than or equal to
Relational Operators are used to form conditions, and conditions can involve constants, variables, numeric operators, and functions.
Assignment (=) vs Comparison (==)
with an implicit data conversion to bool.
equal signs.