Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > Need help with your homework?
|
Need help with your homework? Need help with a homework question on any programming language? Post questions and help here, not in the language topic forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Need help with your homework? section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 20th, 2011, 08:45 PM
Registered User
 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP PLEASE!!!! Can Some one help me find the right code to use to do a task?

HELP showing me or explaining how to do them tasks would be great!

This is the task i can't get. This script is going to implement a usage count system for running the Star Trek game you wrote previously. The total number of times the Star Trek game has been played, along with the date of the most recent play should be stored in the registry. The key used to store the information should be placed under the HKCU\Software key with a subkey name of your liking. The logic diagrammed below should be implemented by your script.
This is what i need help with doing these things:
1. Display the current usage count 2. Reset the current usage count to 0 3. Display last play date 4. play the star trek game 5. quit"

HELP PLease

My code:

Option Explicit

Dim intPlayGame, strSplashImage, strAnswerOne, strAnswerTwo, strAnswerThree, f, filename
Dim strAnswerFour, strAnswerFive, intNumberCorrect, strFederationRank
Dim objFsoObject,WshShell, count
Set WshShell = WScript.CreateObject("WScript.Shell")
filename=InputBox("1. Display the current usage count 2. Reset the current usage count to 0 3. Display last play date 4. play the star trek game 5. quit","Star Trek Main meun on 10/18/11")
Const cTitlebarMsg = "The Star Trek Quiz Game"
f = InputBox("What is your name", "Name PLease")
Do
If filename = 1 Then
count = WshShell.RegRead("HKey\current_user")
If Err.Number <> 0 Then
MsgBox "Apparently, Star Trek application hasn't been run yet!",,"Whoa Nellie!"
else
MsgBox "Star Trek application has been run " & count & " times on this machine."
End If
Elseif filename = 4 Then
'Start the user's score at zero
intNumberCorrect = 0

'Display the splash screen and ask the user if he or she wants to play
strSplashImage = space(11) & "********" & vbCrLf & _
" ******************" & space(20) & "**************************" & _
space(15) & vbCrLf & "*" & space(30) & "*" & space(18) & _
"**" & space(39) & "*" & vbCrLf & " ******************" & _
space(20) & "*************************" & vbCrLf & space(31) & _
"******" & space(26) & "***" & vbCrLf & _
space(34) & "******" & space(22) & "***" & vbCrLf & _
space(37) & "******" & space(17) & "***" & vbCrLf & _
space(26) & " ****************************" & vbCrLf & _
space(26) & "*******************************" & vbCrLf & _
space(26) & "******************************" & vbCrLf & _
space(26) & " ****************************" & vbCrLf & vbCrLf & vbCrLf & _
"Would you like to boldly go where no one has gone before?"

intPlayGame = MsgBox(strSplashImage, 36, cTitlebarMsg)

If intPlayGame = 6 Then 'User elected to play the game

strAnswerOne = InputBox("What was the Science Officer's name in the " & _
"original Star Trek series?", cTitlebarMsg)

If LCase(strAnswerOne) = "spock" Then
intNumberCorrect = intNumberCorrect + 1
else
MsgBox "spock"
End If

Else 'User doesn't want to play

MsgBox "Thank you for taking the Star Trek Quiz." & _
vbCrLf & vbCrLf & "Live long and prosper!", , cTitlebarMsg
WScript.Quit()

End If

strAnswerTwo = InputBox("What Star Trek villain appeared in both the " & _
"original series and a Star Trek movie?", cTitlebarMsg)

If LCase(strAnswerTwo) = "khan" Then
intNumberCorrect = intNumberCorrect + 1
else
MsgBox "khan"
End If

strAnswerThree = InputBox("What was the numeric designation of " & _
"Voyager's on-board Borg?", cTitlebarMsg)

If CStr(strAnswerThree) = "7" Then
intNumberCorrect = intNumberCorrect + 1
ElseIf CStr(strAnswerThree) = "7 of 9" Then
intNumberCorrect = intNumberCorrect + 1
else
MsgBox "7"
End If

strAnswerFour = InputBox("Name the only Star Trek character to " & _
"regularly appear on two series and at least two Star Trek " & _
"movies?", cTitlebarMsg)

If LCase(strAnswerFour) = "worf" Then
intNumberCorrect = intNumberCorrect + 1
else
MsgBox "worf"
End If

strAnswerFive = InputBox("What is the last name of your favorite " & _
"Captain?", cTitlebarMsg)

If Len(strAnswerFive) > 3 Then
If Instr(1, "kirkpicardsiscojanewayarcher", LCase(strAnswerFive), 1) _
<> 0 Then
intNumberCorrect = intNumberCorrect + 1
else
MsgBox "kirkpicardsiscojanewayarcher"
End If
End If

Select Case intNumberCorrect
Case 5 'User got all five answers right
strFederationRank = "Admiral"
Case 4 'User got 4 of 5 answers right
strFederationRank = "Captain"
Case 3 'User got 3 of 5 answers right
strFederationRank = "Commander"
Case 2 'User got 2 of 5 answers right
strFederationRank = "Lieutenant-Commander"
Case 1 'User got 1 of 5 answers right
strFederationRank = "Lieutenant"
Case 0 'User did not get any answers right
strFederationRank = "Ensign"
End Select

MsgBox f & " You answered " & intNumberCorrect & " out of 5 correct." & _
vbCrLf & vbCrLf & "Your Star Fleet rank is : " & _
strFederationRank, , cTitlebarMsg
If filename = 5 Then
End If
end If
Loop
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Failure in Send mail task-ssis package can't find smtp server fig000 SQL Server 2005 0 October 4th, 2009 03:11 PM
How to add task in Scheduled Task programatically amitjoshipune C# 2 July 31st, 2008 05:42 AM
Hide Task bar through vb6 code akhilesh_g Pro VB 6 6 December 28th, 2007 01:23 PM
Execute Task from ActiveX Script Task PorcupineRabbit SQL Server DTS 1 January 10th, 2006 12:37 PM
HELP! I can't find the code! Vincent Yang All Other Wrox Books 0 March 23rd, 2004 05:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.