cs.furman.educs.furman.edu/~pbatchelor/csc105/assignments/csc105 vba... · web viewcsc105 vba...

3
CSC105 VBA Assignments Due Oct. 21 in lab – you will demo your program to me (or Weston) 1. Enhance the simple addition program (Adder 2) by having the user enter his or her guess at the correct answer by means of an Input Box. If the guess is correct, have the message box display “Good guess!”. Otherwise, display the message “You’re wrong!”. ______________________________________________________________ __________ VBA Program 2 Due Oct. 27 Create a Trip Calculator program, executed from a command button, which does the following: 1. Prompts for the person’s First Name 2. Prompts for the person’s Last Name 3. Prompts for the number of miles driven on the recent trip 4. Prompts for the average miles per gallon on the trip 5. Prompts for the average price per gallon of gasoline on the trip 6. Calculates the total cost of the trip 7. Displays the following type of message in one message box: Hint: Use concatenation. Partial example: firstName & " " & lastName & " traveled " & nMiles Hint: To format the numbers for average price per gallon of gasoline and total cost of the trip, here is an example: Format(tripCost, "$0.00")

Upload: nguyenlien

Post on 10-Apr-2018

231 views

Category:

Documents


2 download

TRANSCRIPT

CSC105 VBA Assignments

Due Oct. 21 in lab – you will demo your program to me (or Weston)

1. Enhance the simple addition program (Adder 2) by having the user enter his or her guess at the correct answer by means of an Input Box. If the guess is correct, have the message box display “Good guess!”. Otherwise, display the message “You’re wrong!”.

________________________________________________________________________

VBA Program 2 Due Oct. 27

Create a Trip Calculator program, executed from a command button, which does the following:

1. Prompts for the person’s First Name2. Prompts for the person’s Last Name3. Prompts for the number of miles driven on the recent trip4. Prompts for the average miles per gallon on the trip5. Prompts for the average price per gallon of gasoline on the trip6. Calculates the total cost of the trip7. Displays the following type of message in one message box:

Hint: Use concatenation. Partial example: firstName & " " & lastName & " traveled " & nMilesHint: To format the numbers for average price per gallon of gasoline and total cost of the trip, here is an example: Format(tripCost, "$0.00")Hint: Use this syntax for the Message Box title: vbInformation, "Trip info" (this goes at the end of the MsgBox statement)

Here’s the beginning of the code for the message box above: MsgBox firstName & " " & lastName & " traveled " & nMiles & " miles, got " & milesPerGallon & " miles per gallon on average, paid " & Format(avgPrice, "$0.00")

To continue a program statement to the next line in the code window use the underscore _

Due Oct. 27 in lab – you will demo your programs to me (or Weston)

1. Create a program to do the following:a. Allow the user to enter the Customer’s Nameb. Allow the user to enter the Number of Purchases for the customer (greater than

one)c. Enter the Amount of each purchase as seen below:

d. Display the grand total of the amount of all the purchases

2. Enhance the “Variables, Conditions & Loops” program by having the program display a message in Colum E if there is no deviation. The message should say “No deviation”