• Home
  • Blog
  • Exercises from 4.1 Determine whether the condition is true or false.  Assume a = 2 and b = 3. 3 * a…

Exercises from 4.1 Determine whether the condition is true or false.  Assume a = 2 and b = 3. 3 * a…

0 comments

Exercises from 4.1

 

Determine whether the condition is true or false.  Assume a = 2 and b = 3.

 

  1. 3 * a = 2 * b
  2. (5 – a) * b < 7
  3. b <= 3
  4. (a * a < b) Or Not (a * a < a)

 

Exercises from 4.2

 

  1. Write a program to determine how much to tip the server in a restaurant.  The tip should be 15% of the check, with a minimum of $1.
  2. A bagel shop charges 75 cents per bagel for orders of less than a half-dozen bagels and 60 cents per bagel for orders of a half-dozen or more.  Write a program that requests the number of bagels ordered and displays the total cost.  (Test the program for orders of four bagels and a dozen bagels.)

 

Exercise from 4.3

 

For the responses shown in the parentheses, determine the output displayed in the text box when the button is clicked on.

 

Private Sub btnDisplay_Click(…) Handles btnDisplay.Click

     Dim age, price As Double

     age = CDbl (InputBox (“What is your age?”) )

     Select Case age

     Case Is < 6

          price = 0

     Case 6 To 17

          price = 3.75

     Case Is >= 17

          price = 5

     End Select

     txtOutput.Text = “The price is “ & FormatCurrency (price)

End Sub

 

(8.5, 17)

 

Exercises from 4.4

 

Determine the effect of setting the property to the value shown.

 

 

  1. GroupBox1.Text = “Income”
  2. CheckBox1.Checked = True
  3. CheckBox1.Checked = False
  4. CheckBox1.Text = “&Vanilla”
  5. RadioButton1.Checked = False
  6. txtOutput.Text = 1stBox.Text
  7. RadioButton1.Text = “Clear & All”
  8. RadioButton1.Checked = True

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}