Sunday, August 22, 2010

VBScript Assignment 4

DUE: 8/24
This is a comprehensive exercise covering everything we have done in the VBSCript portion of the class.

Declare a variable or constants and assign appropriate values for the following:

a. The title of the window
b. Your name
c. Tomorrow's date
d. Whether it will snow tomorrow
e. The number of TV channels you recieve

1. Accept a number, print it in reverse

E.g. If you accept 274, print
The reverse of 274 is 472

2. Accept two numbers and print:
a. All the even numbers between them
b. All the odd numbers between them
c. All the prime numbers between them

3. Accept two numbers and sum all the numbers between them:

E.g. If you accept 2 and 5 print:
Input values: 2 and 5
Sum (excluding boundaries): 7
Sum (including boundaries): 14

1. Accept a date in mm/dd/yyyy format and
a. Display a message whether the date is valid or not
b. Display the date in parts as:
Month: January
Day: 14
Year: 2008

2. Accept a date and print whether the date is in the past, present or future.

3. Accept a date and print:
a. Day Before: mm/dd/yy
b. Day After: mm/dd/yy

4. Print yesterday's date

1. Accept a word as input and display all the vowels in it.

E.g. if the word is PROFESSIONAL, display:
A : 1
E : 1
I : 1
O : 2
U : 0

2. Accept FirstName, MiddleName and lastName from a user and write code to display this as:
a. LastName, FirstName MiddleInitial.
b. LastName, FirstName
c. FirstInitial. LastName


1. Write a function that takes a String formatted as currency and returns the value as a number.
If you pass the value $1,234,567.70 it returns 1234567.70
If you pass the value 34,567.70 it returns 34567.70

2. Write a function named IsPrime that accepts a number and returns True if the number is prime and False if the number is not.


Tuesday, August 10, 2010

Assignemnt 3

a. Declare variables or constants for the following items
b. Assign appropriate values to the declared variables

Declare a variable or constants and assign appropriate values using functions:

a. Today's Date
b. Whether it will be cloudy tomorrow
c. The price of a book
d. The name of first month of the year
e. Yesterdays date
f. The name of the user logged into your computer
- This will require research

2. Write VBScript code to print the following in a single message box.
[Note: Do not hardcode the values.]
[Hint: You will need a nested loop]
3. Write a VBScript function that will accept a number and return true if the number is a prime number. False, if the number is not:
Function IsPrime(Byval numInput)
  'Your code goes here
End Function
4. Write a VBScript function that when given a filename, it will return the file size.
if the file does not exist, it should return -1.
[Hint: You will need to use the FileSystemObject to answer this]
5. Write a VBScript function that accepts the following input:
123 Fordham Road, Fremont GA 09321
and prints out the following (in 1 message box)
Number: 123
Street: Fordham
City:   Fremont
State:  GA
Zip:    09321
6. Write a VBScript function that returns the date in MM/DD/YYYY format.
Note that when the day is August 3, 2010, it should display 08/03/2010 and NOT 8/3/2010


Thursday, August 05, 2010

VBScript Assignment 2

This assignment is due on Tuesday (8/10/10)

1. Ask a user for a number an display half the number.
E.g If the user enters 3, display
Half of 3 is 1.5

2. Write a loop to print all the numbers between 1 and 5

3. Write a loop to print all the numbers between 10 and 30 that are cleanly divisible by 2 or 3.