Monday, March 16, 2009

Starts/EndsWith Method ~ Determines whether or not a string of characters are at the beginning or end of a string.
phone = InputBox("10-digit phone numer:", "Phone")Do While phone.StartsWith("312") phoneListBox.Items.Add(phone) phone = InputBox("10-digit phone number", "Phone")LoopDim cityState AS String = cityStateTextBox.Text.ToUpper()If cityState.EndsWith("CA") Then stateLabel.Text = "California customer"End If

Contains Method ~ Searches a string to find if it contains a sting of symbols.
Dim address As String = "345 Main Street, Gelndale, CA"Dim isContained As BooleanisContained = address.Contains("Main Street")

IndexOf Method ~ Like the Contains method, but it gives back an integer telling you where the string is.
Dim message As String = "Have a nice day"Dim indexNum As IntegerindexNum = message.IndexOf("nice", 0)

Substring Method ~ used to access any number of characters contained in a string, such as letter, words, etc.
Dim fullName As String = "Peggy Ryan"firstName = fullName.Substring(0, 5)lastName = fullName.Substring(6)

String.Compart Method ~ Allows you to compart two strings for whether or not they are similar.
Dim result As Integerresult = String.Compare("Dallas", "Dallas")

Like Operator ~ Finds out if two strings are equal to each other.
isEqual = firstName.ToUpper() Like "B?LL"

Radio Button Tool ~ used to add a radio button to the interface.
Check Box Tool ~ used to add a check box button to the interface.

Thursday, February 26, 2009

Article

David Galvez

1. Windows 7: Trouble on the Upgrade Path
http://apple20.blogs.fortune.cnn.com/2009/02/25/windows-7-trouble-on-the-upgrade-path/

2. The latest software from Microsoft, Windows 7 is very dysfunctional and hard to upgrade to with Windows XP.

3. -This has happened before going to Windows XP.
-In order to upgrade to Windows 7, you must use Vista.
-This is the first public beta to be released.
-Microsoft has reached over a million call in complaints.

4. They'll eventually fix it like they've done before.

5. This has happened before with Microsoft going to XP, however, that problem was solved a week after its release. Not to mention, Apple has also had these kinds of errors.

6. Nothing was misunderstood
7. Not surprising at all to me.
8. Do you want a Windows 7?


To Stefano: I'd believe the facts for no other reason than that it's better to be safe than sorry.

Wednesday, February 25, 2009

Chapter 3

1) dim price As Decimal
dim name As String

2) dim height As Decimal
dim width As Integer
dim name As String

3) city = "Miami"

4) dim sales1 As Decimal
dim sales2 As Decimal
dim totalSales As Decimal
totalSales = sales1 + sales2
totalSalesLabel.Text = totalSales

5) dim salary As Decimal
salary = salary * 1.5D
salaryLabel.Text = salary

6) dim employeename As String
'Must be entered in textbox
'Is module level variable

9) isConverted = Integer.TryParse(unitsTextBox.Text, numberOfUnits)

15) A variable whose value does not change during the program.

Chapter 4

7)

If carTextBox.text = "Grand Am" Then
carMakeLabel.text = "Pontiac"
End If

8)

If variable < 0 Then
MessageBox.Show("Entry Error", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Valid Number", "Valid Number", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

9)

If quantity < 10 then
MessageBox.Show("Reorder", "Reorder", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("OK", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

13)

If hours are less than or equal to 40 then multiply hours by hoursRate. Else, subtract forty, multiple the remainder by hoursRate and 1.5. Add 40 time by hourRate.

If hours < 40 Then
gross = hours*hourRate
Else
gross = (hours - 40) * hourRate * 1.5 + 40 * hourRate
End If

Tuesday, February 24, 2009

Review Questions for Chapter 4

  1. C ~ number> 100 AndAlso number <=1000 is valid for condition
  2. C ~ firstNameTextBox.Text.ToUpper() = "BOB" checks if the text is bob.
  3. B ~ 3 is less than 6 and therefore false
  4. A ~ 10 is less than 12 and therefore true
  5. A ~ True, 7 is equal to 7 and therefore true
  6. C ~ Paul will be displayed
  7. B ~ Jerry
  8. C ~ Paul
  9. D ~ Sue
  10. C ~ Nested selection can exist in either case
  11. D ~ Case Is > 7 ~ Case 3, 5 ~ Case 1 To 4 all work
  12. C ~ Paul
  13. C ~ Paul
  14. D ~ Sue
  15. A ~ Advance.NewLine goes to the next line
  16. D ~ String.IsNullOrEmpty(cityname) checks if it is empty
  17. C ~ MessageBox.OK means the message box had been seen
  18. C ~ randomGenerator.Next(9, 55) generates a number between 10 to 55
  19. C ~ addressLabel.Text = city & ", " & state will print city name, state
  20. D ~ Both A and B Same reasoning as #11

Wednesday, February 18, 2009

Wednesday, February 11, 2009

Chapter 3 Review Questions

  1. C ~ Variables are temporary memory locations.
  2. D ~ All names are valid.
  3. C ~ Procedure level variables are only known to its own procedure.
  4. A ~ Literal constant doesn't change while the program is running.
  5. D ~ Variables can change.
  6. C ~ Objects is the default value
  7. B ~ price = 2.89D
  8. C ~ isConverted = TryParse.Decimal (inputRate, rate)
  9. A ~ Add and then convert.
  10. D ~ commission = Convert.ToSingle(sales) * 0.5S
  11. A ~ Const Rate As double - .09
  12. C ~ Convert to string
  13. A ~ ' to comment
  14. A ~ block level variables are used the most
  15. C ~ Implicit off
  16. A ~ Foucs()
  17. C ~ You need "" around strings.
  18. B ~ It needs ()
  19. A ~ Logical error
  20. C ~ D stands for decimal

Thursday, February 5, 2009

Boolean Variable: A variable that can be changed between true and false, true or false

String: A series of characters that do not have numberical data but are a value, "Hello, world!"

Method: The operations that an object is capable of performing,

import System.Globalization: Contains definitions for numberStyles and NumberFormatInfo, age = 35s Operators: mathmatical symbols used in calculations, +-*/

Procedure Scope: The scope of the use of the variable in the procedure,Button click is event procedure.

Block scope: The scope of block-level variables, which can be used only within the statement block in which they are declared, If...Then....Else Option

Strict: strings will not be implicity converted to numbers, and vice versa, narrower data types will be promoted to wider data types, wider data types will not be demoted to narrower.

Focus Method: Used to move the focus to a control while an application is running, sending the focus to the name text box.

Identifier: The name of an object, nameTextBox Literal Constant: An item of data whose value does not change while an application is running, tax rate.

TryParse Method: Used to convert a string to a number. 4 to int 4.

Convert Class: This class contains methods that return the result of converting a value to a specified data type, float to int.

Scope: Indicates where a variable can be used in the application's code, int.money can not be used in order form section.

Comments: Used to document a program internally; created using the apostrophe. 'Read this comment.

Static Variable: a procedure level variable that retains its value when the procedure ends, cost remains the same through out.

Pseudocode: Uses prhases to describe the steps a procedure needs to take to accomplish its goal, Set cost to 4 and then multiple it by 2.

Format Specifier: Determines the special characters that will appear in a formatted number, float to int removes the decimals.

DIM: A method to declare a variable in Visual Basic. Ex. Dim incomeValue

Literal Type Character: a character used to convert a literal constant to data type.

Line Continuation Character: An underscore, which must be preceded by a space; used to break up a long instruction into two or more physical lines in the Code Editor window.

Precedence Numbers: Indicate the order in which the computer performs an operation (such as an arithmetic operation) in an expression.

Lifetime: Indicates how long a variable remains in the computer in the computer’s internal memory.

Module Scope: Refers to the scope of a module-level variable, which can be used by all of the procedures in the current form.

Option Explicit: Disables implicit declaration of variables.

Empty String: A set of quotation marks with nothing between them.

1 You make sure that the variable name doesn’t conflict with other commands and use a discriptive title.blueBoards

2 You use the DIM command to declare a variable.Dim blueBoards As Integer

3 The difference between DIM and Const is that a constant variable is only named once and assigned a value that stays the same, a DIM variable can be changed.Const TaxRate As Decimal = 0.06D

4 To include mathematical expressions in the assignment statements you use a variable.totalSkateboards = blueBoards + yellowBoards

5 To clear a text property when an appliacation is running you use the clear function.blueTextBox.Clear()

6 To format a number for outpout as a string you use the Convert.Tostring function.totalBoardsLabel.Text = Convert.ToString(totalSkateboards)