56
Overview Questions 1. d a program 2. c machine code 3. a Assembly 4. b High-level 5. d All of the above. 6. b JIT compiler 7. c class 8. d talk 9. c instance 10. b encapsulation 11. a abstraction 12. d Polymorphism 13. a base, derived 14. d inheritance 15. a) head, body, legs, heart, lungs b) eat, run, play, walk, bark c) three Programming with VB 2005 3E 1 0-4188-3674-5

Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

OverviewQuestions1. d a program2. c machine code3. a Assembly4. b High-level5. d All of the above.6. b JIT compiler7. c class8. d talk9. c instance10. b encapsulation11. a abstraction12. d Polymorphism13. a base, derived14. d inheritance15. a) head, body, legs, heart, lungs

b) eat, run, play, walk, barkc) three

Programming with VB 2005 3E 10-4188-3674-5

Page 2: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 1 – Lesson AQuestions1. c Properties2. d Solution Explorer3. b .sln4. d All of the above.5. b Text6. c Name7. d StartPosition8. The Text property controls the text that appears in the Windows form’s title bar, and on the application’s

button on the Windows taskbar while the application is running. The Name property assigns a name to the Windows Form object; you use the name to refer to the form in code. The programmer uses the Name property. The user reads the Text property.

9. A Windows Form object is the form itself. A Windows Form object can be viewed in the designer window and appears on the screen when the application is run. The form file object is the disk file that contains the code associated with the Windows Form object.

10. The dot member access operator indicates that the Label class is a member of the Forms namespace, which is a member of the Windows namespace, which is a member of the System namespace.

Exercises1. See the VB2005\Chap01\laCharities Solution files on the Solutions Disk. 2. See the VB2005\Chap01\laPhoto Solution files on the Solutions Disk.3. See the VB2005\Chap01\laYorktown Solution files on the Solutions Disk.4. (Discovery) See the VB2005\Chap01\laGreenwood Solution files on the Solutions Disk.

d. The ControlBox property determines whether a form has a Control/System menu box in the title bar. e. Setting the ControlBox property to False removes the icon and the Minimize, Maximize, and Close

buttons from the form’s title bar.g. The MaximizeBox property determines whether a form has a Maximize button in the title bar.h. Setting the MaximizeBox property to False dims (grays-out) the Maximize button in the form’s title bar.j. The MinimizeBox property determines whether a form has a Minimize button in the title bar.k. Setting the MinimizeBox property to False dims (grays-out) the Minimize button in the form’s title bar.

5. (Discovery) See the VB2005\Chap01\laGreenwood Solution files on the Solutions Disk.d. The ShowIcon property determines whether an icon appears in the form’s title bar.e. The ShowInTaskbar property determines whether the value stored in the form’s Text property appears on

the Windows taskbar when the application is running.

Chapter 1 – Lesson BQuestions1. c Label2. d Text3. d All of the above.4. d All of the above.5. a System.Windows.Forms6. b The executable file that Visual Basic automatically creates when you start an application has the

same name as the solution, but with an .exe extension.7. a Me.Close8. Syntax refers to the rules of a programming language.9. You use the Class Name list box to select the object you want to code. You use the Method Name list box to

select the event you want to code.10. A keyword is a word that has a special meaning in a programming language.

Programming with VB 2005 3E 20-4188-3674-5

Page 3: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Exercises1. See the VB2005\Chap01\lbMechanics Solution files on the Solutions Disk. 2. See the VB2005\Chap01\lbCostello Solution files on the Solutions Disk.3. See the VB2005\Chap01\lbTabatha Solution files on the Solutions Disk.4. (Discovery) See the VB2005\Chap01\lbJerrods Solution files on the Solutions Disk.

Chapter 1 – Lesson CQuestions1. c timer2. a Enabled3. b Tick4. c 10,0005. b The user can see a timer control while the application is running.6. c MinimizeBox7. d FormBorderStyle8. a ControlBox9. To print a project’s code, open the Code Editor window. Click File on the menu bar, and then click Print.

Click the OK button in the Print dialog box. 10. Delete the control from the form. Open the Code Editor window and delete the code contained in the control’s

event procedures.

Exercises1. See the VB2005\Chap01\lcJefferson Solution files on the Solutions Disk. 2. See the VB2005\Chap01\lcSplash Solution files on the Solutions Disk. The student is instructed to create his

or her own splash screen.3. (Discovery) See the VB2005\Chap01\lcOnOff Solution files on the Solutions Disk. (This solution also is used

in Discovery Exercise 4, which teaches the student to display a graphic on each button’s face.)4. (Discovery) See the VB2005\Chap01\lcModified OnOff Solution files on the Solutions Disk. 5. (Discovery) See the VB2005\Chap01\lcTooltip Solution files on the Solutions Disk.6. (Debugging) See the VB2005\Chap01\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student must remove the label control’s Click event procedure from the Code Editor window, and then enter the Me.Close() statement in the xExitButton’s Click event procedure.

Programming with VB 2005 3E 30-4188-3674-5

Page 4: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 2 – Lesson AQuestions1. b label2. c text box3. d TOE4. c upper-left corner5. a first6. a book title capitalization7. c Identifying labels should be entered using book title capitalization.8. b Sentence capitalization9. 2 Identify the objects to which you will assign the tasks.

4 Draw a sketch of the user interface.1 Identify the tasks the application needs to perform.3 Identify the events required to trigger an object into performing its assigned tasks.

10. 5 Test and debug the application.3 Build the user interface.4 Code the application.6 Assemble the documentation.2 Plan the application.1 Meet with the client.

Exercises1. TOE charts and sketches may vary.

Task Object EventGet the following from the user: name sales commission rate

xNameTextBoxxSalesTextBoxxRateTextBox

NoneNoneNone

Calculate the commission xCalcButton ClickDisplay the following: name sales commission rate commission

xNameTextBoxxSalesTexBoxxRateTextBoxxCalcButton, xCommissionLabel

NoneNoneNoneClick, None

End the application xExitButton ClickClear the screen xClearButton Click

Programming with VB 2005 3E 40-4188-3674-5

Page 5: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Task Object Event1. Calculate the commission 2. Display the commission in

the xCommissionLabel control

xCalcButton Click

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the commission (from xCalcButton)

xCommissionLabel None

Get and display the name, sales, and rate

xNameTextBox, xSalesTextBox, xRateTextBox

None

Sample of a vertical arrangement:

Sample of a horizontal arrangement:

2. TOE charts and sketches may vary.

Task Object EventGet the following from the user: current year’s sales for each region projected increase % for each region

xNorthSalesTextBox, xSouthSalesTextBox, xEastSalesTextBox, xWestSalesTextBoxxNorthIncreaseTextBox, xSouthIncreaseTextBox, xEastIncreaseTextBox, xWestIncreaseTextBox

None

Calculate the projected sales for each region

xCalcButton Click

Programming with VB 2005 3E 50-4188-3674-5

Page 6: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Display the following: current year’s sales for each region

projected increase % for each region

projected sales for each region

xNorthSalesTextBox, xSouthSalesTextBox, xEastSalesTextBox, xWestSalesTextBox

xNorthIncreaseTextBox, xSouthIncreaseTextBox, xEastIncreaseTextBox, xWestIncreaseTextBox

xCalcButtonxNorthSalesLabel, xSouthSalesLabel, xEastSalesLabel, xWestSalesLabel

None

None

ClickNone

End the application xExitButton ClickClear the screen xClearButton Click

Task Object Event1. Calculate the projected sales

for each region2. Display the projected sales in

the xNorthSalesLabel, xSouthSalesLabel, xEastSalesLabel, and xWestSalesLabel controls

xCalcButton Click

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the projected sales (from xCalcButton)

xNorthSalesLabel, xSouthSalesLabel, xEastSalesLabel, xWestSalesLabel

None

Get and display the projected increase % for each region

xNorthIncreaseTextBox, xSouthIncreaseTextBox, xEastIncreaseTextBox, xWestIncreaseTextBox

None

Get and display the current year’s sales for each region

xNorthSalesTextBox, xSouthSalesTextBox, xEastSalesTextBox, xWestSalesTextBox

None

Sample of a vertical arrangement:

Programming with VB 2005 3E 60-4188-3674-5

Page 7: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Sample of a horizontal arrangement:

3. See the VB2005\Chap02\laTime Solution files on the Solutions Disk. Answers may vary.

Programming with VB 2005 3E 70-4188-3674-5

Page 8: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 2 – Lesson BQuestions1. b TabIndex2. d both b and c3. a dark text on a light background4. b x5. a sans serif6. d BorderStyle7. a &8. d Text9. The first choice for an access key is the first letter of the caption or identifying label, unless another letter

provides a more meaningful association. If you can’t use the first letter and no other letter provides a more meaningful association, then use a distinctive consonant in the caption or label. The last choices are a vowel or number in the caption or label.

10. To give keyboard access to a text box, assign an access key to its identifying label control. Then set the label control’s TabIndex property to a value that is one number less than the text box’s TabIndex value.

Exercises1. See the VB2005\Chap02\lbPaper Solution files on the Solutions Disk.2. See the VB2005\Chap02\lbRMSales Solution files on the Solutions Disk.3. See the VB2005\Chap02\lbTime Solution files on the Solutions Disk.

Chapter 2 – Lesson CQuestions1. a Me.xNameTextBox.Text = ‘’2. b Me.xTotalLabel.Text = Val(Me.xSales1Label.Text + Me.xSales2Label.Text)3. b Format4. d Val5. d rectangle6. a a logic error7. b a syntax error8. 2.929. 210. 23

Exercises1. See the VB2005\Chap02\lcPaper Solution files on the Solutions Disk. Answer using valid test data: $200.00

commission 2. See the VB2005\Chap02\lcRMSales Solution files on the Solutions Disk. Answers using valid test data: North

projected sales are 27,500.00; South projected sales are 10,500.00; East projected sales are 10,400.00; West projected sales are 16,650.00

3. See the VB2005\Chap02\lcTime Solution files on the Solutions Disk. Answers using valid test data: 30 weekday hours and 2 weekend hours

4. See the VB2005\Chap02\lcJohnLee Solution files on the Solutions Disk. (The interface might not contain a Clear button.) Answer using first set of test data: 4500 ending balanceAnswer using second set of test data: 0 ending balance

Task Object Event1. Calculate ending balance 2. Display ending balance in xEndLabel control

xCalcButton Click

Programming with VB 2005 3E 80-4188-3674-5

Page 9: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the ending balance (from xCalcButton) xEndLabel NoneGet and display the beginning balance, monthly earnings, monthly expenses

xBeginTextBox, xEarnTextBox, xExpTextBox

None

Pseudocode:xCalcButton: Calculate ending balance = beginning balance + monthly earnings – monthly

expensesDisplay ending balance in xEndLabel control

xClearButton: Clear the Text property of the xBeginTextBox, xEarnTextBox, xExpTextBox controlsClear the Text property of the xEndLabel controlSend the focus to the xBeginTextBox control

xExitButton: End the application

5. See the VB2005\Chap02\lcLanaJones Solution files on the Solutions Disk. (The interface might not contain a Clear button.) Answer using first set of test data: 18 average Answer using second set of test data: 0 average

Task Object Event1. Calculate average of three numbers 2. Display average in xAvgLabel control

xCalcButton Click

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the average (from xCalcButton) xAvgLabel NoneGet and display the first number, second number, and third number

xNum1TextBox, xNum2TextBox, xNum3TextBox

None

Pseudocode:xCalcButton: Calculate average = (first number + second number + third number) / 3

Display average in xAvgLabel control

xClearButton: Clear the Text property of the xNum1TextBox, xNum2TextBox, xNum3TextBox controlsClear the Text property of the xAvgLabel controlSend the focus to the xNum1TextBox control

xExitButton: End the application

6. See the VB2005\Chap02\lcBookworms Solution files on the Solutions Disk. (The interface might not contain a Clear button.) Answers using first set of test data: $4,000.00 paperback value, $3,750.00 hardcover value, 150 total versions, $7,750.00 total valueAnswers using second set of test data: $0.00 paperback value, $0.00 hardcover value, 0 total versions, $0.00 total value

Task Object Event1. Calculate the paperback value, hardcover

value, total number of paperback and hardcover versions, and total value of the paperback and hardcover versions

2. Display the calculated amounts in the

xCalcButton Click

Programming with VB 2005 3E 90-4188-3674-5

Page 10: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

xPaperValLabel, xHardValLabel, xTotalNumLabel, and xTotalValLabel controls

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the paperback value, hardcover value, total number of paperbacks and hardcover versions, and total value of paperback and hardcover versions (from xCalcButton)

xPaperValLabel, xHardValLabel, xTotalNumLabel, xTotalValLabel

None

Get and display the title, number of paperback versions, number of hardcover versions, cost of paperback version, cost of hardcover version

xTitleTextBox, xNumPaperTextBox, xNumHardTextBox, xCostPaperTextBox, xCostHardTextBox

None

Programming with VB 2005 3E 100-4188-3674-5

Page 11: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Pseudocode:xCalcButton: Calculate paperback value = number of paperback versions * paperback cost

Calculate hardcover value = number of hardcover versions * hardcover costCalculate total number of paperback and hardcover versions = number of

paperback versions + number of hardcover versionsCalculate total value of paperback and hardcover versions = paperback value +

hardcover valueDisplay paperback value, hardcover value, total number of paperback and

hardcover versions, and total value of paperback and hardcover versions in xPaperValLabel, xHardValLabel, xTotalNumLabel, and xTotalValLabel controls

xClearButton: Clear the Text property of the xTitleTextBox, xNumPaperTextBox, xNumHardTextBox, xCostPaperTextBox, and xCostHardTextBox controls

Clear the Text property of the xPaperValLabel, xHardValLabel, xTotalNumLabel, and xTotalValLabel controls

Send the focus to the xTitleTextBox control

xExitButton: End the application

7. See the VB2005\Chap02\lcJackets Solution files on the Solutions Disk. (The interface might contain a Clear button.) Answers using first set of test data: 12.50 discount and 37.50 new priceAnswers using second set of test data: 0.00 discount and 0.00 new price

Task Object Event1. Calculate the discount and the new price 2. Display the discount and the new price in the

xDiscountLabel and xNewPriceLabel controls

xCalcButton Click

End the application xExitButton ClickDisplay the discount and new price (from xCalcButton)

xDiscountLabel, xNewPriceLabel

None

Get and display the original price xOrigPriceTextBox None

Pseudocode:xCalcButton: Calculate discount = original price * 25%

Calculate new price = original price – discountDisplay the discount in the xDiscountLabel controlDisplay the new price in the xNewPriceLabel controlSend the focus to the xOrigPriceTextBox control

xExitButton: End the application

8. See the VB2005\Chap02\lcTypingSalon Solution files on the Solutions Disk. (The interface might not contain a Clear button.) Answers using first set of test data: $75.00 total dueAnswers using second set of test data: $0.00 total due

Task Object Event1. Calculate the total due2. Display the total due in the xTotalLabel

control

xCalcButton Click

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the total due (from xCalcButton) xTotalLabel NoneGet and display the name, number of typed envelopes, and number of typed pages

xNameTextBox, xEnvelopesTextBox,

None

Programming with VB 2005 3E 110-4188-3674-5

Page 12: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

xPagesTextBox

Programming with VB 2005 3E 120-4188-3674-5

Page 13: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Pseudocode:xCalcButton: Calculate total due = number of typed envelopes * .10 +

number of typed pages * .25Display the total due in the xTotalLabel control

xClearButton: Clear the Text property of the xNameTextBox, xEnvelopesTextBox, and xPagesTextBox controlsClear the Text property of the xTotalLabel controlSend the focus to the xNameTextBox control

xExitButton: End the application

Programming with VB 2005 3E 130-4188-3674-5

Page 14: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

9. See the VB2005\Chap02\lcSun Solution files on the Solutions Disk. (The interface might not contain a Clear button.) Answers using first set of test data: 480.00 gross, 96.00 FWT, 38.40 FICA, 9.60 state tax, 336.00 net Answers using second set of test data: 0.00 gross, 0.00 FWT, 0.00 FICA, 0.00 state tax, 0.00 net

Task Object Event1. Calculate gross pay, FWT, FICA, state tax,

and net pay2. Display the calculated amounts in the

xGrossLabel, xFwtLabel, xFicaLabel, xStateLabel, and xNetLabel controls

xCalcButton Click

Clear the screen xClearButton ClickEnd the application xExitButton ClickDisplay the gross pay, FWT, FICA, state tax, and net pay (from xCalcButton)

xGrossLabel, xFwtLabel, xFicaLabel, xStateLabel, xNetLabel

None

Get and display the name, hours worked, and rate of pay

xNameTextBox, xHoursTextBox, xRateTextBox

None

Pseudocode:xCalcButton: Calculate the gross pay = hours worked * rate of pay

Calculate the FWT = gross pay * 20%Calculate the FICA = gross pay * 8%Calculate the state tax = gross pay * 2%Calculate the net pay = gross pay – FWT – FICA – state taxDisplay the gross pay in the xGrossLabel controlDisplay the FWT in the xFwtLabel controlDisplay the FICA in the xFicaLabel controlDisplay the state tax in the xStateLabel controlDisplay the net pay in the xNetLabel control

xClearButton: Clear the Text property of the xNameTextBox, xHoursTextBox, and xRateTextBox controlsClear the Text property of the xGrossLabel, xFwtLabel, xFicaLabel, xStateLabel, and xNetLabel controlsSend the focus to the xNameTextBox control

xExitButton: End the application

10. See the VB2005\Chap02\lcModified Skate Away Solution files on the Solutions Disk.11. (Discovery) See the VB2005\Chap02\lcDiscovery Skate Away Solution files on the Solutions Disk. 12. (Discovery) See the VB2005\Chap02\lcColfax Solution files on the Solutions Disk. (The interface might

contain a Clear button.) Answer using test data: 7 full boxes and 3 remaining

Task Object Event1. Calculate the number of full boxes and the

number remaining2. Display the number of full boxes and the

number remaining in the xFullLabel and xRemainLabel controls

xCalcButton Click

End the application xExitButton ClickDisplay the number of full boxes and the number remaining (from xCalcButton)

xFullLabel, xRemainLabel

None

Get and display the inventory quantity and the number that can be packed in a box

xQuantityTextBox, xBoxTextBox

None

Programming with VB 2005 3E 140-4188-3674-5

Page 15: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Pseudocode:xCalcButton: Calculate the number of full boxes = inventory quantity \ number that can be

packed in a boxCalculate the number remaining = inventory quantity Mod number that can be

packed in a box (Note: the student also could use the following equation: inventory quantity – number of full boxes * number that can be packed in a box)

Display the number of full boxes in the xFullLabel controlDisplay the number remaining in the xRemainLabel controlSend the focus to the xQuantityTextBox control

xExitButton: End the application

13. (Debugging) See the VB2005\Chap02\lcDebug Skate Away Solution files on the Solutions Disk.

Programming with VB 2005 3E 150-4188-3674-5

Page 16: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 3 – Lesson AQuestions1. d Both b and c.2. a literal constant3. c Object4. d Private5. d Static score As Integer 6. b Dim city As String7. d Double.TryParse(Me.xSalesTextBox.Text, sales)8. a Const Rate As Double = .099. d None of the above.10. b Option Strict On

ExercisesIn Exercises 1 through 4, the variable’s name and data type may vary.1. Dim itemName As String

Dim price As Decimal2. Dim item As String

Dim height As DecimalDim weight As Integer

3. Dim item As StringDim beginStock As IntegerDim purchased As IntegerDim sold As IntegerDim endStock As Integer

4. Private partNumber As StringPrivate cost As Decimal

5. city = “Miami”6. itemName = “Desk”

quantityInStock = 40quantityOnOrder = 20

7. totalSales = northSales + southSales8. salary = salary * 1.5D9. Private employeeName As String

The statement should be entered in the form’s Declarations section. The variable is a module-level variable.10. Const TaxRate As Decimal = .05D11. Integer.TryParse(Me.xUnitsTextBox.Text, numberOfUnits)12. Me.xUnitsLabel.Text = Convert.ToString(numberOfUnits)13. totalSales = Convert.ToString(westSales + eastSales)14. (Discovery) See the VB2005\Chap03\laScope Solution files on the Solutions Disk.

c. The number 500 appears in the xSalesLabel control. The procedure-level sales variable is removed from memory.h. The number zero appears because the assignment statement in the xComm5Button’s Click event procedure multiplies the contents of the sales variable (0) by .05, and then displays the result (0) in the xCommissionLabel control. When the xComm5Button’s Click event procedure ends, the sales variable declared in the procedure is removed from memory.q. When the application ends, the module-level sales variable is removed from memory.

15. (Debugging) See the VB2005\Chap03\laCount Solution files on the Solutions Disk.f. You can use either a module-level variable or a static variable. The static variable is the preferred way.

Chapter 3 – Lesson BProgramming with VB 2005 3E 160-4188-3674-5

Page 17: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Questions1. d All of the above.2. d &3. a Me.xRegionLabel.Text = region1 & region24. c Me.xAddressLabel.Text = cityName & “, ” & stateName5. c ControlChars.NewLine6. a AcceptButton7. a Double.TryParse(InputBox(“Enter a number:”, “Number”), number)8. c cityName = Inputbox(“Enter the city:”, “City”)9. b sentence capitalization10. b Me.xSalesLabel.Text = sales.ToString(“N2”)

Exercises1. See the VB2005\Chap03\lbModified Skate Away Solution files on the Solutions Disk.2. See the VB2005\Chap03\lbCommission Solution files on the Solutions Disk. 3. See the VB2005\Chap03\lbMingo Solution files on the Solutions Disk.4. See the VB2005\Chap03\lbModified Mingo Solution files on the Solutions Disk.5. See the VB2005\Chap03\lbIMY Solution files on the Solutions Disk.6. See the VB2005\Chap03\lbModified IMY Solution files on the Solutions Disk.7. Me.xAddressLabel.Text = cityName & “, ” & stateName8. Me.xAddressLabel.Text = Message & “ ” & stateName & “ is ” & cityName &

“.”9. Me.xAddressLabel.Text = “My ZIP code is ” & zipCode & “.”10. (Discovery) See the VB2005\Chap03\lbCancel Solution files on the Solutions Disk.

Chapter 3 – Lesson CQuestions1. b static2. d Static counter as Integer3. d TextChanged4. a Private Sub GetNumber(ByVal sender As Object, ByVal e As

System.EventArgs) Handles xNum1TextBox.Click, xNum2TextBox.Click

Exercises1. See the VB2005\Chap03\lcName Solution files on the Solutions Disk. 2. See the VB2005\Chap03\lcPennies Solution files on the Solutions Disk.3. See the VB2005\Chap03\lcChange Solution files on the Solutions Disk.4. See the VB2005\Chap03\lcCurrency Calculator Solution files on the Solutions Disk.5. (Discovery) See the VB2005\Chap03\lcConversion Functions Solution files on the Solutions Disk. The

TryParse method can handle invalid data (such as a letter), whereas the conversion functions cannot.6. (Debugging) See the VB2005\Chap03\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student must include parentheses around the test1 + test2 + test3 expression.

Programming with VB 2005 3E 170-4188-3674-5

Page 18: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 4 – Lesson AQuestions1. d only the false path in the If…Then…Else statement2. b cost > 100 AndAlso cost <= 10003. d Me.xNameTextBox.Text.ToUpper = “BOB”4. 4 Xor

2 And1 Not3 Or2 AndAlso3 OrElse

5. 1 Arithmetic3 Logical2 Comparison

6. b False7. a True8. b False9. b False10. a True11. a True12. c 18013. d 300014. b True15. b True

Programming with VB 2005 3E 180-4188-3674-5

Page 19: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Exercises1.

2. If Me.xCarTextBox.Text.ToUpper = “GRAND AM” ThenMe.xCarMakeLabel.Text = “Pontiac”

End If3. If String.IsNullOrEmpty(Me.xZipTextBox.Text) Then

Me.xMsgLabel.Text = “Please enter your ZIP code”End If

4. If isSalesOk ThenMe.xMsgLabel.Text = Convert.ToString(sales * .1)

ElseMe.xMsgLabel.Text = “Please enter a number”

End If5. If units < 0 Then

Me.xMessageLabel.Text = “Entry error”Else

Me.xMessageLabel.Text = “Valid Number”End If

6. If quantity < 10 ThenMe.xMessageLabel.Text = “Reorder”

ElseMe.xMessageLabel.Text = “OK”

End If7. If sales <= 250 Then

bonus = 10Else

bonus = 15End If

8. If state.ToUpper = “HAWAII” ThenMe.xShippingLabel.Text = “25”

ElseMe.xShippingLabel.Text = “50”

Programming with VB 2005 3E 190-4188-3674-5

start

if hours > 40

display “Overtime pay”

T

display “Regular pay”

F

stop

Page 20: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

End If

Programming with VB 2005 3E 200-4188-3674-5

Page 21: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

9.

If state.ToUpper = “COLORADO” ThenMe.xSalesTaxLabel.Text = Convert.ToString(.03 * sales)

ElseMe.xSalesTaxLabel.Text = Convert.ToString(.04 * sales)

End If 10. if the hours worked are greater than 40

calculate gross pay = hours worked * pay rate + (hours worked - 40) * pay rate/2else

calculate gross pay = hours worked * pay rateend ifdisplay the gross payIf hours > 40D Then

gross = hours * hourRate + (hours – 40D) * hourRate/2DElse

gross = hours * hourRateEnd IfMe.xGrossLabel.Text = Convert.ToString(gross)

Programming with VB 2005 3E 210-4188-3674-5

start

if state is Colorado

display sales * .03

T

display sales * .04

F

stop

Page 22: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

11.

If animal.ToUpper = “D” ThenMe.xAnimalLabel.Text = “Dog”

ElseMe.xAnimalLabel.Text = “Cat”

End If12. if the item is a desk and the state is Colorado

calculate discount = sales * .1display discount

end if

If item.ToUpper = “DESK” AndAlso state.ToUpper = “COLORADO” Thendiscount = sales * .1Me.xDiscountLabel.Text = discount.ToString(“C2”)

End If13. If itemColor.ToUpper = “RED” AndAlso item.ToUpper = “SHIRT” Then

increase = .02D * origPriceElse

increase = .01D * origPriceEnd IfnewPrice = origPrice + increaseMe.xOriginalLabel.Text = origPrice.ToString(“N2”)Me.xIncreaseLabel.Text = increase.ToString(“N2”)Me.xNewLabel.Text = newPrice.ToString(“N2”)

14. If marySales < jeffSales ThenDim temp As Decimaltemp = marySalesmarySales = jeffSalesjeffSales = temp

End If15. See the VB2005\Chap04\laModified AddSub Solution files on the Solutions Disk.

Programming with VB 2005 3E 220-4188-3674-5

start

if animal is “D”

display “Dog”

T

display “Cat”

F

stop

Page 23: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

16. See the VB2005\Chap04\laBonus Solution files on the Solutions Disk.17. See the VB2005\Chap04\laSum Solution files on the Solutions Disk.18. (Discovery) See the VB2005\Chap04\laCharCase Solution files on the Solutions Disk.

Chapter 4 – Lesson BQuestions1. a When you delete a group box, the controls contained within the group box remain on the form.2. c 5.03. d All of the above.4. b Financial.Pmt(.09/4, 3 * 4, 6000, 0, DueDate.BegOfPeriod)5. b -Financial.Pmt(.03/12, 120, 0, 50000, DueDate.BegOfPeriod)6. c icon7. c MessageBoxIcon.Exclamation8. a an OK button and the Information Message icon9. d None of the above.10. a Windows.Forms.DialogResult.OK

Exercises1. See the VB2005\Chap04\lbWeekly Savings Solution files on the Solutions Disk. 2. See the VB2005\Chap04\lbMingo Solution files on the Solutions Disk.3. (Discovery)

c. In addition to the MessageBoxIcon.Exclamation constant, the MessageBoxIcon.Warning constant displays the Warning Message icon. d. The MessageBoxIcon.Asterisk and MessageBoxIcon.Information constants display the Information Message icon. e. The MessageBoxIcon.Error, MessageBoxIcon.Hand, and MessageBoxIcon.Stop constants display the Stop Message icon. f. The MessageBoxIcon.Question constant displays a symbol consisting of a question mark in a circle.

Chapter 4 – Lesson CQuestions1. b KeyPress2. c e.Handled = True3. d If e.KeyChar = ControlChars.Back Then4. b If e.KeyChar = “$” Then5. b Enter6. a Me.xCityTextBox.SelectAll()

Exercises1. See the VB2005\Chap04\lcMicro Solution files on the Solutions Disk. 2. See the VB2005\Chap04\lcState ID Solution files on the Solutions Disk.3. See the VB2005\Chap04\lcAllenton Solution files on the Solutions Disk.4. See the VB2005\Chap04\lcSkate Away Solution – Ex4 files on the Solutions Disk.5. See the VB2005\Chap04\lcSkate Away Solution – Ex5 files on the Solutions Disk.6. See the VB2005\Chap04\lcMessageBox Value Solution files on the Solutions Disk.7. (Discovery) See the VB2005\Chap04\lcDiscovery Bonus Solution files on the Solutions Disk.8. (Discovery) See the VB2005\Chap04\lcZip Solution files on the Solutions Disk. (The student will need to set

the text box control’s MaxLength property.)9. (Debugging) See the VB2005\Chap04\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student must include parentheses around e.KeyChar < "0" OrElse e.KeyChar > "9" in the

Programming with VB 2005 3E 230-4188-3674-5

Page 24: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

CancelKeys procedure, and also around code = “1” OrElse code = “2” in the xCalcButton Click event procedure.

Programming with VB 2005 3E 240-4188-3674-5

Page 25: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 5 – Lesson AQuestions1. c 1802. d 30003. b 2004. c Mark5. b Jerry6. c Mark7. d Sue8. c either the true path or the false path9. d All of the above.10. b Mark11. b Mark12. d Sue13. a If sender Is Me.xNameTextBox Then14. d If TypeOf sender Is Label Then15. a If partNum Like “??#” Then16. a If item.ToUpper = “SHIRT” OrElse item.ToUpper = “SKIRT” Then17. c If Me.xRateTextBox.Text Like “*%” Then18. The decision regarding the member status is the primary decision. The decision regarding the day of the week

is the secondary decision, because whether it needs to be made depends on the result of the member status decision.

19. The three errors commonly made when writing selection structures are:1. Using a logical operator when a nested selection structure is needed2. Reversing the primary and secondary decisions3. Using an unnecessary nested selection structureThe “Using an unnecessary nested selection structure” error makes the selection structure inefficient, but not incorrect.

20. Desk-checking, also called hand-tracing, means that you use sample data to walk through each of the steps in the algorithm manually, just as though you were the computer.

Programming with VB 2005 3E 250-4188-3674-5

Page 26: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Exercises1. Dim code As String

Dim sales As DecimalDim bonus As Decimalcode = Me.xCodeTextBox.TextDecimal.TryParse(Me.xSalesTextBox.Text, sales)bonus = sales * .08DIf code.ToUpper = “X” Then

If sales >= 10000 Thenbonus = bonus + 150D

Elsebonus = bonus + 125D

End IfEnd IfMe.xMsgLabel.Text = bonus.ToString(“N2”)

2. If score >= 90 Then Me.xMsgLabel.Text = "Highest honors"

ElseIf score >= 70 Then Me.xMsgLabel.Text = “Good job” Else

Me.xMsgLabel.Text = "Retake the test" End If

3. If quantity = 10 ThenMe.xMsgLabel.Text = “Equal”

ElseIf quantity > 10 ThenMe.xMsgLabel.Text = “Over 10”

ElseMe.xMsgLabel.Text = “Not over 10”

End If4. Integer.TryParse(Me.xCodeTextBox.Text, code)

Decimal.TryParse(Me.xSalesTextBox.Text, sales)If code = 1 OrElse code = 2 Then

Me.xMsgLabel.Text = Convert.ToString(sales * .12D)ElseIf code = 3 Then

Me.xMsgLabel.Text = Convert.ToString(sales * .15D)ElseIf code = 4 Then

Me.xMsgLabel.Text = Convert.ToString(sales * .2D)Else

Me.xMsgLabel.Text = “Error”End If

5. Integer.TryParse(Me.xCodeTextBox.Text, code)Decimal.TryParse(Me.xSalesTextBox.Text, sales)Select Case code

Case 1Me.xMsgLabel.Text = Convert.ToString(sales * .02D)

Case 2 To 4 Me.xMsgLabel.Text = Convert.ToString(sales * .05D)

Case 5Me.xMsgLabel.Text = Convert.ToString(sales * .1D)

Case 6 To 7Me.xMsgLabel.Text = Convert.ToString(sales * .15D)

Case ElseMe.xMsgLabel.Text = “Error”

End Select6. Select Case state

Case “HAWAII”shipCharge = 25.0

Programming with VB 2005 3E 260-4188-3674-5

Page 27: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Case “OREGON”shipCharge = 30.0

Case “CALIFORNIA”shipCharge = 32.5

Case ElseshipCharge = 0.0Me.xMsgLabel.Text = “Incorrect state”

End Select7. If state = “HAWAII” Then

shipCharge = 25.0 ElseIf state = “OREGON” Then

shipCharge = 30.0 ElseIf state = “CALIFORNIA” Then

shipCharge = 32.5 Else

shipCharge = 0.0Me.xMsgLabel.Text = “Incorrect state”

End If8. Select Case seatLoc

Case “BOX”Me.xPriceLabel.Text = “$75.00”

Case “PAVILION”Me.xPriceLabel.Text = “$30.00”

Case “LAWN”Me.xPriceLabel.Text = “$21.00”

Case ElseMe.xPriceLabel.Text = “Incorrect seat location”

End Select9. If seatLoc = “BOX” Then

Me.xPriceLabel.Text = “$75.00” ElseIf seatLoc = “PAVILION” Then

Me.xPriceLabel.Text = “$30.00” ElseIf seatLoc = “LAWN” Then

Me.xPriceLabel.Text = “$21.00” Else

Me.xPriceLabel.Text = “Incorrect seat location”End If

10. If zipCode Like “605##” ThenshipCharge = 25.0

ElseIf zipCode Like “606##” ThenshipCharge = 30.0

Else shipCharge = 35.0

End If11. Select Case True

Case zipCode Like “605##”shipCharge = 25.0

Case zipCode Like “606##” shipCharge = 30.0

Case Else shipCharge = 35.0

End Select12. If sender Is xAlabamaButton Then

Me.xCapitalLabel.Text = “Montgomery” ElseIf sender Is xArizonaButton Then

Me.xCapitalLabel.Text = “Phoenix” ElseIf sender Is xIllinoisButton Then

Me.xCapitalLabel.Text = “Springfield” Else

Programming with VB 2005 3E 270-4188-3674-5

Page 28: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Me.xCapitalLabel.Text = “Salem” End If13. Select Case True

Case sender Is xAlabamaButtonMe.xCapitalLabel.Text = “Montgomery”

Case sender Is xArizonaButtonMe.xCapitalLabel.Text = “Phoenix”

Case sender Is xIllinoisButtonMe.xCapitalLabel.Text = “Springfield”

Case ElseMe.xCapitalLabel.Text = “Salem”

End Select14. See the VB2005\Chap05\laAnimal Solution files on the Solutions Disk.15. See the VB2005\Chap05\laMonth Solution files on the Solutions Disk.16. See the VB2005\Chap05\laBonus Solution files on the Solutions Disk.17. See the VB2005\Chap05\laSeminar Solution files on the Solutions Disk.

Chapter 5 – Lesson BQuestions1. b two2. b sentence capitalization3. b False4. b two5. d six6. a Checked7. c Dim numberRandom As New Random8. b number = randomGenerator.Next(1, 26)9. a Call10. d Me.xAlaskaRadioButton.PerformClick()

Exercises1. See the VB2005\Chap05\lbMath Solution-PerformClick files on the Solutions Disk. 2. See the VB2005\Chap05\lbCapitals Solution files on the Solutions Disk.3. See the VB2005\Chap05\lbJuarez Solution files on the Solutions Disk. 4. See the VB2005\Chap05\lbFat Calculator Solution files on the Solutions Disk.5. (Discovery) See the VB2005\Chap05\lbRandom Float Solution files on the Solutions Disk.

Chapter 5 – Lesson CQuestions1. d None of the above.2. a Checked3. a True4. b False

Exercises1. See the VB2005\Chap05\lcModified Math Solution files on the Solutions Disk. 2. See the VB2005\Chap05\lcHealth Solution files on the Solutions Disk.3. See the VB2005\Chap05\lcWashington Solution files on the Solutions Disk.4. See the VB2005\Chap05\lcBarren Solution files on the Solutions Disk.5. See the VB2005\Chap05\lcGolf Pro Solution files on the Solutions Disk.6. See the VB2005\Chap05\lcMarshall Solution files on the Solutions Disk.7. See the VB2005\Chap05\lcWillow Solution files on the Solutions Disk.

Programming with VB 2005 3E 280-4188-3674-5

Page 29: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

8. See the VB2005\Chap05\lcJohnson Solution files on the Solutions Disk.9. See the VB2005\Chap05\lcLottery Solution files on the Solutions Disk.10. See the VB2005\Chap05\lcFerris Solution files on the Solutions Disk.11. (Debugging) See the VB2005\Chap05\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student must modify the Select Case statement as follows: Select Case total Case Is < 100.0 shipping = 0 Case Is < 501.0 shipping = 10 Case Is < 1001.0 shipping = 7 Case Else shipping = 5 End Select

Programming with VB 2005 3E 290-4188-3674-5

Page 30: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 6 – Lesson AQuestions1. b 42. c 123. c either a or b4. a posttest, pretest5. d All of the above.6. a 07. b 18. a (sequence) and b (selection)9. a (sequence) and c (repetition)10. a (sequence) and b (selection)11. a (sequence) and b (selection) and c (repetition)12. c priming

Exercises1. Do While quantity > 02. Do Until quantity <= 03. Do Until inStock <= reorder4. Do While inStock > reorder5. Do While letter.ToUpper = “Y”6. Do Until letter.ToUpper <> “Y”7. Do While empName.ToUpper <> “DONE”8. Do Until empName.ToUpper = “DONE”9. quantity = quantity + 210. total = total – 311. totalPurchases = totalPurchases + purchases12. sales = sales – salesReturns13. For evenNum = 2 To 8 Step 2

Me.xNumbersLabel.Text = _Me.xNumbersLabel.Text & Convert.ToString(evenNum) & _ControlChars.NewLine

Next evenNum 14. Dim evenNum As Integer = 2

Do While evenNum <= 8Me.xNumbersLabel.Text = _

Me.xNumbersLabel.Text & Convert.ToString(evenNum) & _ControlChars.NewLine

evenNum = evenNum + 2Loop

15. Dim evenNum As Integer = 2Do

Me.xNumbersLabel.Text = _Me.xNumbersLabel.Text & Convert.ToString(evenNum) & _ControlChars.NewLine

evenNum = evenNum + 2Loop While evenNum <= 8

16. Dim count As Integer = 10Do While count < 100

Me.xCountLabel.Text = _Me.xCountLabel.Text & Convert.ToString(count * 2) & _ControlChars.NewLine

count = count + 10Loop

Programming with VB 2005 3E 300-4188-3674-5

Page 31: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

17. For x = 0 To 117 Step 9Me.xNumbersLabel.Text = _

Me.xNumbersLabel.Text & Convert.ToString(x) & _ControlChars.NewLine

Next x18. For x = 2 To 12 Step 2

Me.xiNumbersLabel.Text = _Me.xNumbersLabel.Text & Convert.ToString(x * x) & _ControlChars.NewLine

Next x19. 0, 1,2, 3, 420. 0, 1, 2, 3, 4, 521. The number = number + 1 instruction is missing and should be entered after the MessageBox.Show

instruction.22. The number = number - 1 instruction is missing and should be entered after the MessageBox.Show

instruction.23. 0, 2, 424. 125. See the VB2005\Chap06\laModified Payment Calculator Solution files on the Solutions Disk.26. See the VB2005\Chap06\laModified Sales Express Solution files on the Solutions Disk. 27. (Debugging) The salesInput = InputBox(“Enter a sales amount”, “Sales) instruction

is missing and should be entered after the MessageBox.Show instruction.28. (Debugging) The MessageBox.Show instruction should be entered after the Do instruction.

Chapter 6 – Lesson BQuestions1. a *** ***2. d 30

Exercises1. See the VB2005\Chap06\lbNested Payment Solution-Ex1 files on the Solutions Disk. 2. See the VB2005\Chap06\lbNested Payment Solution-Ex2 files on the Solutions Disk.3. See the VB2005\Chap06\lbGrade Calculator Solution files on the Solutions Disk.

Chapter 6 – Lesson CQuestions1. a Add2. a Items3. b SelectedIndex4. d both a and c5. c SelectedValueChanged

Exercises1. See the VB2005\Chap06\lcModified Shoppers Haven Solution files on the Solutions Disk. 2. See the VB2005\Chap06\lcPowder Solution files on the Solutions Disk.3. See the VB2005\Chap06\lcRandom Solution files on the Solutions Disk.4. See the VB2005\Chap06\lcPhone Solution files on the Solutions Disk.5. See the VB2005\Chap06\lcModified Phone Solution files on the Solutions Disk.6. See the VB2005\Chap06\lcFibonacci Solution files on the Solutions Disk.

Programming with VB 2005 3E 310-4188-3674-5

Page 32: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

7. See the VB2005\Chap06\lcMultiplication Solution files on the Solutions Disk.8. See the VB2005\Chap06\lcGPA Solution files on the Solutions Disk.9. (Discovery) See the VB2005\Chap06\lcMulti Solution files on the Solutions Disk.10. (Discovery) See the VB2005\Chap06\lcItems Solution files on the Solutions Disk.11. (Discovery) See the VB2005\Chap06\lcListBox Solution files on the Solutions Disk.12. (Discovery) See the VB2005\Chap06\lcSonheim Solution files on the Solutions Disk.13. (Debugging) See the VB2005\Chap06\lcDebug Solution files on the Solutions Disk. Modifications are

shaded in the following code.Private Sub xEnterButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xEnterButton.Click' displays the number of positive integers, the number of negative integers, ' and the number of zeros entered

Dim inputNumber As StringDim number As IntegerDim positiveCounter As IntegerDim negativeCounter As IntegerDim zeroCounter As IntegerDim isConverted As Boolean

inputNumber = InputBox("Enter an integer. Click Cancel to end. ", _"Number Entry", "0")

Do While inputNumber <> String.EmptyisConverted = Integer.TryParse(inputNumber, number)If isConverted Then ' update appropriate counter

If number > 0 ThenpositiveCounter = positiveCounter + 1

ElseIf number < 0 Then negativeCounter = negativeCounter + 1 Else zeroCounter = zeroCounter + 1 End If Else MessageBox.Show("Please enter a number", "Number Entry", _ MessageBoxButtons.OK, MessageBoxIcon.Information)

End If inputNumber = InputBox("Enter an integer. Click Cancel to end. ", _ "Number Entry", "0")Loop

' display countersMe.xPositiveLabel.Text = Convert.ToString(positiveCounter)Me.xNegativeLabel.Text = Convert.ToString(negativeCounter)Me.xZeroLabel.Text = Convert.ToString(zeroCounter)End Sub

Programming with VB 2005 3E 320-4188-3674-5

Page 33: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 7 – Lesson AQuestions1. a A Function procedure can return one or more values to the statement that called it.2. a arguments3. c a parameter4. b the procedure header5. a Call CalcArea(length, width)6. d None of the above.7. c Private Sub CalcFee(ByVal base As Integer, ByVal rate As Decimal)8. a one value only9. d All of the above. 10. c The name of each argument in the Call statement should be identical to the name of its corresponding

parameter in the procedure header.11. a Return stateTax12. c Private Sub CalcFee(ByVal base As Integer, ByRef rate As

Decimal)13. d Both a and c.14. c by reference15. d To pass a variable by reference in Visual Basic, you include the ByRef keyword before the variable’s

name in the Call statement.16. a Private Sub CalcEndingInventory(ByVal b As Integer, ByVal s As

Integer, ByVal p As Integer, ByRef final As Integer)17. a Call CalcEndingInventory(begin, sales, purchases, ending)18. a True19. d All of the above.20. c grossPay = Calculate(hours, rate)21. Unlike a Sub procedure, a Function procedure returns a value when it has completed its task.22. When you pass a variable by value, you are passing only the contents of the variable; the receiving procedure

cannot access the variable and cannot change its contents. When you pass a variable by reference, you are passing the address of the variable in the computer’s internal memory; the receiving procedure can access the variable and can change its contents. To pass a variable by value, you include the keyword ByVal before the variable’s name in the procedure header. To pass a variable by reference, you include the keyword ByRef before the variable’s name in the procedure header.

Exercises1. Private Sub HalveNumber(ByVal num As Integer)

Me.xNumLabel.Text = Convert.ToString(num / 2)End Sub

2. Call HalveNumber(87)3. Private Sub GetCity(ByRef cityName As String)

cityName = InputBox(“Enter the city name:”, “City Name”)End Sub

4. Call GetCity(city)5. Private Sub CalcSumAndDiff(ByVal num1 As Integer, ByVal num2 As Integer,

ByRef sum As Integer, ByRef diff As Integer)sum = num1 + num2diff = num1 – num2

End Sub6. Call CalcSumAndDiff(firstNum, secondNum, sum, difference)7. Private Sub CalcQuotient(ByVal num1 As Decimal, ByVal num2 As Decimal,

ByRef quotient As Decimal)quotient = num1 / num2

End Sub8. Private Function DivideNumber(ByVal num As Integer) As DoubleProgramming with VB 2005 3E 330-4188-3674-5

Page 34: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Return num / 2End Function

9. answer = DivideNumber(number)10. Private Function GetState() As String

Dim state As Stringstate = InputBox(“State name:”, “State Name”)Return state

End Function11. MessageBox.Show(GetState())12. Private Function CalcAverage(ByVal number1 As Integer, ByVal number2 As

Integer, ByVal number3 As Integer, ByVal number4 As Integer) As DecimalReturn (number1 + number2 + number3 + number4) / 4

End Function13. average = CalcAverage(num1, num2, num3, num4)14. See the VB2005\Chap07\laPassing Solution files on the Solutions Disk. In Step c, the xDisplayButton’s Click

event procedure does not display your name because the myName variable was passed by value. In Step e, the xDisplayButton’s Click event procedure displays your name because the myName variable was passed by reference.

15. See the VB2005\Chap07\laRainfall Solution files on the Solutions Disk.16. See the VB2005\Chap07\laModified Gross Pay Solution files on the Solutions Disk.17. See the VB2005\Chap07\laModified Pine Lodge Solution files on the Solutions Disk.18. See the VB2005\Chap07\laModified Rainfall Solution files on the Solutions Disk.19. See the VB2005\Chap07\laTemperature Solution files on the Solutions Disk.20. See the VB2005\Chap07\laModified Temperature Solution files on the Solutions Disk.21. (Discovery) See the VB2005\Chap07\laOptional Solution files on the Solutions Disk.

Chapter 7 – Lesson BQuestions1. a Add2. b DropDownStyle3. a Items4. d All of the above.5. c Text6. b Math.Round(number, 3)7. d Sorted8. d TextChanged

Exercises1. See the VB2005\Chap07\lbSub Harvey Industries Solution files on the Solutions Disk. 2. See the VB2005\Chap07\lbModified Harvey Industries Solution files on the Solutions Disk.3. See the VB2005\Chap07\lbNo Rounding Harvey Industries Solution files on the Solutions Disk.

Chapter 7 – Lesson CQuestions1. d FormClosing2. d FormClosing3. c e.Cancel = True

Exercises1. See the VB2005\Chap07\lcFormClosing Gross Pay Solution. 2. See the VB2005\Chap07\lcFormClosing Pine Lodge Solution files on the Solutions Disk.

Programming with VB 2005 3E 340-4188-3674-5

Page 35: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

3. (Debugging) See the VB2005\Chap07\lcDebug Solution files on the Solutions Disk. To debug this solution, the student must add the statement Return result to the GetArea function.

Programming with VB 2005 3E 350-4188-3674-5

Page 36: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 8 – Lesson AQuestions1. d Both b and c 2. a state = state.Remove(2, 3)3. a amount = amount.Trim(“$”c, “%”c)4. c partNum.StartsWith(“A”)5. d partNum.ToUpper.EndsWith(“B”)6. c code = partNum.Substring(0, 3)7. d All of the above.8. c zip = zip.Replace(“1”, “3”)9. d All of the above.10. d None of the above.11. b word = word.Insert(2, “a”)12. c 1013. d None of the above.14. d newMessage = message.PadRight(13, “!”c)15. c 0

Exercises1.

a. Me.xSizeLabel.Text = Convert.ToString(message.Length)b. city = city.TrimStartc. number = number.Trimd. amount = amount.TrimEnd(“ ”c, “,”c, “.”c)e. fullName = fullName.Remove(0, 2)f. Mid(word, 4) = “th”g. word = word.Insert(0, “a”)h. pay = pay.PadLeft(10, “*”c)

2. If inputRate.EndsWith(“%”) TheninputRate = inputRate.TrimEnd(“%”c)

End If3. code = part.Substring(4, 2)4. amount = amount.Replace(“,”, “”)5. indexNum = address.ToUpper.IndexOf(“ELM STREET”)6. isContained = address.ToUpper().Contains(“ELM STREET”)7. result = String.Compare(item, itemOrdered)8. See the VB2005\Chap08\laCity Names Solution files on the Solutions Disk.9. See the VB2005\Chap08\laSocial Security Solution files on the Solutions Disk.10. See the VB2005\Chap08\laModified Social Security Solution files on the Solutions Disk.11. See the VB2005\Chap08\laPhone Solution files on the Solutions Disk.12. See the VB2005\Chap08\laItem Prices Solution files on the Solutions Disk.13. See the VB2005\Chap08\laDate Solution files on the Solutions Disk.14. See the VB2005\Chap08\laSales Tax Solution files on the Solutions Disk.15. See the VB2005\Chap08\laPart Number Solution files on the Solutions Disk.16. See the VB2005\Chap08\laCount Solution files on the Solutions Disk.17. See the VB2005\Chap08\laName Solution files on the Solutions Disk.18. See the VB2005\Chap08\laAlphabet Solution files on the Solutions Disk.

Chapter 8 – Lesson B

Programming with VB 2005 3E 360-4188-3674-5

Page 37: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Questions1. b a separator bar2. a an access key3. c A shortcut key4. c You should assign a shortcut key to commonly used menu titles.5. A menu item’s access key can be used only when the menu is open. A menu item’s shortcut key can be used

only when the menu is closed.

Exercises1. See the VB2005\Chap08\lbCommission Solution files on the Solutions Disk.

Chapter 8 – Lesson CQuestions1. b For indexNum As Integer = 0 To name.Length - 12. d Mid(name, 1) = “C”3. a True

Exercises1. See the VB2005\Chap08\lcHangman Game Solution-Ex1 files on the Solutions Disk. 2. See the VB2005\Chap08\lcHangman Game Solution-Ex2 files on the Solutions Disk.3. See the VB2005\Chap08\lcPig Latin Solution files on the Solutions Disk.4. See the VB2005\Chap08\lcGeorgetown Solution files on the Solutions Disk.5. See the VB2005\Chap08\lcJacobson Solution files on the Solutions Disk.6. See the VB2005\Chap08\lcBobCat Motors Solution files on the Solutions Disk.7. (Debugging) See the VB2005\Chap08\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student must modify the Remove method in the xDisplayButton’s Click event procedure, as shown here: city = address.Remove(indexNum)

Programming with VB 2005 3E 370-4188-3674-5

Page 38: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 9 – Lesson AQuestions1. a Dim amounts(4) As Double2. d Do While x <= 203. b replace the 500 amount with 5104. d If x >= 0 AndAlso x <= 4 Then5. d None of the above.6. a Array.Sort(sales)7. b Do While x < 4

total = total + numbers(x) x = x + 1Loopavg = Convert.ToDecimal(total / x)

8. a 09. c 610. b 511. d 812. d elements = numbers.Length

Exercises1. Dim numbers(19) As Integer

numbers(1) = 72. Private products(9) As String

products(2) = “Paper”3. Dim rates As Double = {6.5, 8.3, 4, 2, 10.5}4. For x As Integer = 0 To 4

Me.xRatesLabel.Text = Me.xRatesLabel.Text & _ Convert.ToString(rates(x)) & ControlChars.NewLine

Next x

Dim x As IntegerDo While x <= 4

Me.xRatesLabel.Text = Me.xRatesLabel.Text & _ Convert.ToString(rates(x)) & ControlChars.NewLinex = x + 1

Loop

For Each x As Integer in ratesMe.xRatesLabel.Text = Me.xRatesLabel.Text & _

Convert.ToString(x) & ControlChars.NewLineNext x

5. Array.Sort(rates)6. Array.Reverse(rates)7. For x As Integer = 0 To 4

total = total + rates(x)Next xMe.xAverageLabel.Text = Convert.ToString(total / x)

Dim x As IntegerDo While x <= 4

total = total + rates(x)x = x + 1

LoopMe.xAverageLabel.Text = Convert.ToString(total / x)

Programming with VB 2005 3E 380-4188-3674-5

Page 39: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

For Each x As Integer in ratestotal = total + x

Next xMe.xAverageLabel.Text = Convert.ToString(total / rates.length)

8. Dim x As IntegerDo While x <= 4

rates(x) = rates(x) - 1x = x + 1

Loop

For x As Integer = 0 To 4rates(x) = rates(x) - 1

Next x

For Each x As Integer in ratesx = x - 1

Next x9. See the VB2005\Chap09\laLowest Solution-ForNext, laLowest Solution-ForEachNext, laLowest Solution-

DoLoop files on the Solutions Disk.10. See the VB2005\Chap09\laUpdate Prices Solution files on the Solutions Disk.11. See the VB2005\Chap09\laModified Update Prices Solution files on the Solutions Disk.12. See the VB2005\Chap09\laScores Solution files on the Solutions Disk.

d. 3 students earned a score of 724 students earned a score of 881 student earned a score of 202 students earned a score of 99

13. See the VB2005\Chap09\laModified Scores Solution files on the Solutions Disk.d. 6 students earned a score between 70 and 79, inclusive

8 students earned a score between 65 and 85, inclusive2 students earned a score between 0 and 50, inclusive

14. See the VB2005\Chap09\laLottery Game Solution files on the Solutions Disk.15. (Discovery) See the VB2005\Chap09\laReDim Solution files on the Solutions Disk

a. The ReDim statement allows you to reallocate storage space for an array variable. In other words, it allows you to dynamically change the size of an array. The Preserve keyword allows you to preserve the data in the existing array when you change the size of only the last dimension.

Chapter 9 – Lesson BQuestions1. a True2. a capital(1)

Exercises1. See the VB2005\Chap09\lbCarver Solution files on the Solutions Disk. 2. See the VB2005\Chap09\lbModified Carver Solution files on the Solutions Disk.3. See the VB2005\Chap09\lbLaury Solution files on the Solutions Disk.

Chapter 9 – Lesson CQuestions1. b Dim letters(3, 1) As String2. d replace the 800 amount with 8103. b replace the 2000 amount with 900

Programming with VB 2005 3E 390-4188-3674-5

Page 40: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

4. d If row >= 0 AndAlso row < 2 AndAlso col >= 0 AndAlso col < 5 Then5. d states(4, 2) = “California”6. d All of the above.

Exercises1. Dim balances(3, 5) As Decimal

For row As Integer = 0 To 3For col As Integer = 0 To 5

balances(row, col) = 10DNext col

Next row2. Dim row As Integer

Dim Col As IntegerDo While row <= 3

Do While col <= 5balances(row, col) = 10Dcol = col + 1

Looprow = row + 1

Loop3. For Each element As Decimal In balances

element = 10DNext element

4. answers(2, 0) = True5. See the VB2005\Chap09\lcInventory Solution files on the Solutions Disk.6. See the VB2005\Chap09\lcConway Solution files on the Solutions Disk.7. See the VB2005\Chap09\lcCount Solution files on the Solutions Disk.8. See the VB2005\Chap09\lcHighest Solution files on the Solutions Disk.9. (Debugging) See the VB2005\Chap09\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student must insert a comma within the parentheses in the Dim statement that declares the names array. The student also must change the For clause in the For…Next statement to For row As Integer = 0 to 4.

Programming with VB 2005 3E 400-4188-3674-5

Page 41: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 10 – Lesson AQuestions1. c Structure2. a Declarations section3. b address.street = “Maple”4. d None of the above.5. a Dim workers(4) As Employee

Exercises1. Structure Book

Public title As StringPublic author As StringPublic cost As Decimal

End StructurePrivate fiction As Book

2. Structure TapePublic name As StringPublic artist As StringPublic songLength As StringPublic songNum As Integer

End StructureDim blues As Tape

3. a. Dim homeUse As Computerb. homeUse.model = “IB-50”c. homeUse.cost = 2400Dd. Private business(9) As Computere. business(0).model = “HPP405”f. business(0).cost = 3600D

4. a. Dim school As Friendb. school.first = Me.xFirstTextBox.Textc. school.last = Me.xLastTextBox.Textd. Me.xLastLabel.Text = school.laste. Me.xFirstLabel.Text = school.firstf. Private home(4) As Friendg. home(4).first = Me.xFirstTextBox.Texth. home(4).last = Me.xLastTextBox.Text

5. See the VB2005\Chap10\laModified Price List Solution-Structure files on the Solutions Disk.6. See the VB2005\Chap10\laCarver Solution files on the Solutions Disk.

Chapter 10 – Lesson BQuestions1. b My.Computer.FileSystem.WriteAllText(“address.txt”,

Me.xAddressTextBox.Text, False)2. d fileContents = My.Computer.FileSystem.ReadAllText(“address.txt”)3. c If My.Computer.FileSystem.FileExists(“address.txt”) Then4. d All of the above.5. c My.Computer.FileSystem.WriteAllText(“msg.txt”, Strings.Space(15),

True)

Programming with VB 2005 3E 410-4188-3674-5

Page 42: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Exercises1. My.Computer.FileSystem.WriteAllText(“report.txt”, “Employee” &

ControlChars.NewLine & “Name” & ControlChars.NewLine”, False)2. My.Computer.FileSystem.WriteAllText(“geography.txt”, capital &

Strings.Space(20) & state & ControlChars.NewLine, False)3. text = My.Computer.FileSystem.ReadAllText(“report.txt”)4. Me.xReportLabel.Text = My.Computer.FileSystem.ReadAllText(“report.txt”)5. If My.Computer.FileSystem.FileExists(“jansales.txt”) Then

Me.xMessageLabel.Text = “File exists”Else

Me.xMessageLabel.Text = “File does not exist”End If

6. See the VB2005\Chap10\lbEmployee List Solution files on the Solutions Disk. 7. See the VB2005\Chap10\lbMemo Solution files on the Solutions Disk.8. See the VB2005\Chap10\lbReport Solution files on the Solutions Disk.9. (Discovery) See the VB2005\Chap10\lbPay Solution files on the Solutions Disk.

Chapter 10 – Lesson CQuestions1. a My.Computer.FileSystem.WriteAllText(“cities.txt”, city &

ControlChars.NewLine, True)2. b Me.xCitiesComboBox.Items.Remove(“Paris”)3. b My.Computer.FileSystem.DeleteFile(“cities.txt”)

Exercises1. See the VB2005\Chap10\lcFriends Solution-Erase files on the Solutions Disk. 2. See the VB2005\Chap10\lcFriends Solution-ListBox files on the Solutions Disk.3. See the VB2005\Chap10\lcGlovers Solution files on the Solutions Disk.4. See the VB2005\Chap10\lcFriends Solution-Ignore Case files on the Solutions Disk.5. See the VB2005\Chap10\lcFriends Solution-Modified Add files on the Solutions Disk.6. See the VB2005\Chap10\lcWKRK Solution files on the Solutions Disk.7. (Discovery) See the VB2005\Chap10\lcGlovers Solution-Discovery files on the Solutions Disk.8. (Debugging) See the VB2005\Chap10\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student will need to change the For clause in the Click event procedures for the xLastButton, xFirstButton, and xFullButton as follows: For row As Integer = 0 To names.length -1

Programming with VB 2005 3E 420-4188-3674-5

Page 43: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 11 – Lesson AQuestions1. d A class is considered an object.2. a class file whose filename ends with .vb3. d variables4. a True5. b False6. c SetDate7. c FirstName8. a default9. d item.Price = 4510. c newPrice = item.CalculateNewPrice()11. a True12. b using properties created by Property procedures13. c Public14. d None of the above.15. c signature16. c a Sub procedure17. d Both b and c.18. d Call dog.DisplayBreed()19. c Set20. a Get

Exercises1. Public Class Book

Public Title As StringPublic Author As StringPublic Cost As Decimal

End Class2. Public Class Tape

Public Name As StringPublic Artist As StringPublic SongNumber As StringPublic Length As String

End Class 3. Private fiction As Book

fiction = New Book4. Dim blues As New Tape5. a. Dim homeUse As New Computer

b. homeUse.Model = “IB-50”c. homeUse.Cost = 2400Dd. newPrice = homeUse.IncreasePrice()e. Dim companyUse As New Computer(“IBM”, 1236.99D)

6. Public Class EmployeePrivate _name As StringPrivate _salary As Decimal

Public Property EmpName() As StringGet

Return _nameEnd GetSet(ByVal value As String)

_name = valueEnd Set

End PropertyProgramming with VB 2005 3E 430-4188-3674-5

Page 44: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Public Property Salary() As DecimalGet

Return _salaryEnd GetSet(ByVal value As Decimal)

_salary = valueEnd Set

End Property

Public Sub New()_name = String.Empty_salary = 0D

End Sub

Public Sub New(ByVal n As String, ByVal s As Decimal)EmpName = nSalary = s

End SubEnd Class

7. Public Class EmployeePrivate _name As StringPrivate _salary As Decimal

Public Property EmpName() As StringGet

Return _nameEnd GetSet(ByVal value As String)

_name = valueEnd Set

End Property

Public Property Salary() As DecimalGet

Return _salaryEnd GetSet(ByVal value As Decimal)

_salary = valueEnd Set

End Property

Public Sub New()_name = String.Empty_salary = 0D

End Sub

Public Sub New(ByVal n As String, ByVal s As Decimal)EmpName = nSalary = s

End Sub

Public Function CalculateNewSalary(ByVal percent As Decimal) As Decimal

Dim newSalary As DecimalIf percent >= 0 Then

newSalary = _salary + _salary _* (percent / 100D)

Else newSalary = 0D

Programming with VB 2005 3E 440-4188-3674-5

Page 45: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

End IfReturn newSalary

End FunctionEnd Class

8. Public ReadOnly Property BonusRate() As DecimalGet

Return _bonusRateEnd Get

End Property9. See the VB2005\Chap11\laModified Area Solution files on the Solutions Disk.10. See the VB2005\Chap11\laModified Grade Solution files on the Solutions Disk.11. See the VB2005\Chap11\laModified Personnel Solution files on the Solutions Disk.12. See the VB2005\Chap11\laModified Salary Solution files on the Solutions Disk.13. See the VB2005\Chap11\laModified Sweets Solution files on the Solutions Disk.

Chapter 11 – Lesson BQuestions1. b overloaded2. c Overloads3. a Inherits Animal4. c Public Overridable Sub CalcBonus()5. d Public Overrides Sub CalcBonus()

Exercises1. See the VB2005\Chap11\lbModified ABC Solution-Inheritance files on the Solutions Disk.2. See the VB2005\Chap11\lbArea Solution-Overloads files on the Solutions Disk.

Chapter 11 – Lesson CQuestions1. b False2. a _location = “Unknown”3. b Capital = capName

Exercises1. See the VB2005\Chap11\lcModified Kessler Solution files on the Solutions Disk.2. See the VB2005\Chap11\lcFence Solution files on the Solutions Disk.3. See the VB2005\Chap11\lcPool Solution files on the Solutions Disk.4. See the VB2005\Chap11\lcMath Solution files on the Solutions Disk.5. See the VB2005\Chap11\lcMayflower Solution files on the Solutions Disk.6. See the VB2005\Chap11\lcModified Mayflower Solution files on the Solutions Disk.7. See the VB2005\Chap11\lcFranklin Calendars Solution files on the Solutions Disk.8. (Discovery) See the VB2005\Chap11\lcModified Pool Solution files on the Solutions Disk.9. (Discovery) See the VB2005\Chap11\lcPennington Solution files on the Solutions Disk.10. See the VB2005\Chap11\lcDebug Solution files on the Solutions Disk. To debug the solution, the student will

need to add the Set block in the Id and Price Property procedures. The student will also need to make three changes in the xCalcButton’s Click event procedure. First, the student will need to change Computer.Price to computerPurchased.Price. Second, the student will need to change Computer.Id to computerPurchased.Id. Third, the student will need to change Computer.CalcNewPrice(rate) to computerPurchased.CalcNewPrice(rate).

Programming with VB 2005 3E 450-4188-3674-5

Page 46: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Programming with VB 2005 3E 460-4188-3674-5

Page 47: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

Chapter 12 – Lesson AQuestions1. a foreign key in the child table2. b binding3. d TableAdapter4. b BindingSource object’s Position5. c MovePrevious()6. d All of the above are true.7. b BindingSource8. d All of the above.

Exercises1. See the VB2005\Chap12\laModified Morgan Industries Solution-Labels files on the Solutions Disk.2. See the VB2005\Chap12\laCartwright Solution files on the Solutions Disk.3. See the VB2005\Chap12\laAddison Playhouse Solution files on the Solutions Disk.4. See the VB2005\Chap12\laMorgan Industries Solution-ListBox files on the Solutions Disk.5. (Discovery) See the VB2005\Chap12\laMorgan Industries Solution-NoCopy files on the Solutions Disk.

Chapter 12 – Lesson BQuestions1. d All of the above.2. d Structured Query Language3. c SELECT First, Middle, Last FROM dbo.tblNames4. b SELECT SocialNum FROM dbo.tblPensionInfo ORDER BY SocialNum DESC5. a SELECT Id, Name, Status FROM dbo.Worker WHERE Status = ‘A’6. b SELECT State, Capital, Population FROM dbo.tblState7. d None of the above.8. d None of the above.9. b used in a WHERE clause in a SELECT statement10. b False

Exercises1. See the VB2005\Chap12\lbModified Morgan Industries Solution-DataGrid-Query files on the Solutions Disk.2. See the VB2005\Chap12\lbCartwright Solution-Query files on the Solutions Disk.3. See the VB2005\Chap12\lbCollege Courses Solution files on the Solutions Disk.4. (Discovery) See the VB2005\Chap12\lbMorgan Industries Solution-DataGrid-ToolStrip files on the Solutions

Disk.

Chapter 12 – Lesson CQuestions1. a recordPtr = Me.tblStateBindingSource.Position2. a numRecords = Me.ProductDataSet.Products.Count

Exercises1. See the VB2005\Chap12\lcTrivia Game Solution-Ex1 files on the Solutions Disk.2. See the VB2005\Chap12\lcTrivia Game Solution-Ex2 files on the Solutions Disk.3. See the VB2005\Chap12\lcSports Action Solution files on the Solutions Disk.4. (Discovery) See the VB2005\Chap12\lcTrivia Game Solution-Disc files on the Solutions Disk.

Programming with VB 2005 3E 470-4188-3674-5

Page 48: Overviewinfotech.armstrong.edu/leihe/VB/BookSolutions/ZakVB… · Web viewOverview Questions d a program c machine code a Assembly b High-level d All of the above. b JIT compiler

5. (Discovery) See the VB2005\Chap12\lcFiction Bookstore Solution files on the Solutions Disk.6. (Debugging) See the VB2005\Chap12\lcDebug Solution files on the Solutions Disk. To debug this solution,

the student will need to change Me.FriendsDataSet to Me.FriendsDataSet.tblFriends in the xFillButton’s Click event procedure. The student will also need to change Me.TblFriendsBindingSource.MoveLast() to Me.TblFriendsBindingSource.MoveNext() in the xNextButton’s Click event procedure.

Programming with VB 2005 3E 480-4188-3674-5