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.


DECLARATION
-----------
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


NUMERIC
-------
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


DATE
----
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


STRINGS
------
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


FUNCTIONS
---------

1. Write a function that takes a String formatted as currency and returns the value as a number.
E.g.
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.

Labels:

Tuesday, August 10, 2010

Assignemnt 3

1. DECLARATION
--------------
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

Labels:

Saturday, July 31, 2010

VBScript Assignment

This assignment is due on Tuesday (8/3/2010)

1. DECLARATION
--------------
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 for the following:

a. Today's Date
b. The name of a file
c. The number of people in Columbus
d. The number of days in a week
e. The number of days in a year
f. Whether it will be cloudy tomorrow
g. The price of a book
h. The first month of the year
i. Yesterdays date
j. Whether a test passed or failed.


2. Compete the following
'Complete the following script to convert
'an input time in minutes into hours and minutes

Option Explicit

Dim numInput, numHour, numMinute
Dim strMessage

numInput = InputBox("Enter time in minutes")
numInput = CInt(numInput)

'ToDo
'Convert the time to hours and minutes
'Assign the result to strMessage as the following
' 150 minutes equals 2hr(s) and 30min(s)

Msgbox strMessage


3. Write a short VBScript program that accepts a number from a user in Celsius and converts it to Fahrenheit.

The formula for Celsius to Fahrenheit conversion is:
a. Multiply the Celsius temperature by 9
b. Divide the answer by 5
c. Now add 32

Labels:

Tuesday, April 27, 2010

Assignment

1.
'Complete the following code to display whether a number is
'a. Less than 0
'b. Between 0 and 10
'c. Between 11 and 100
'd. Greater than 100
'
'Display the result as the following example where 20 is the input
' 20 is between 11 and 100

Dim numInput
numInput = InputBox("Please enter a number")


2.
'Write VBScript code to display the following in 1 message box
'
'Day: 12
'Month: February
'Year: 2010

3.
'Write VBScript code to display the size of your C drive

Labels: ,

Wednesday, July 23, 2008

Assignment 1

Due: 7/25/08

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

[Note: You can use SCITE a VBScript editor as your IDE> The application is free and can be downloaded here: http://users.hfx.eastlink.ca/~gisdev/scite-1.75-setup-1.exe]

1. The title of the last book you read
2. Your name
3. Tomorrow's date
4. Whether it will be sunny tomorrow
5. The number of TV channels you receive
6. The number of people on the planet
7. The cost of a gallon of gas

Labels: