How very primitive.
Printable View
Oooh Oooh Aah.
If anyone can compile Python, this is what I've come up with after only a few days of working with Python:
Code:import datetime
#The customer and policy class
class customer:
last = ""
first = ""
dob = datetime.MINYEAR
address = ""
city = ""
state = ""
zip = 0
policies = []
class policy:
holder = customer
number = 0
location = ""
city = ""
state = ""
zip = 0
premium = 0
effective = datetime.MINYEAR
expiration = datetime.MAXYEAR
#These are the main menus
def main_menu():
print ("Main - Menu")
print ("___________")
print ("Search - 1")
print ("Add - 2")
print ("Remove - 3")
print ()
return int(input())
def search_menu():
print ("Search - Menu")
print ("__________________")
print ("Last Name - 1")
print ("Policy Number - 2")
print ("Main Menu - 3")
print ()
return int(input())
def add_menu():
print ("Add - Menu")
print ("________________")
print ("Add Customer - 1")
print ("Add Policy - 2")
print ("Main Menu - 3")
print ()
return int(input())
def remove_menu():
print ("Remove - Menu")
print ("_________________")
print ("Last Name - 1")
print ("Policy Number - 2")
print ("Main Menu - 3")
print ()
return int(input())
#These are the sub menus
#Search Sub Menu(s)
def sub_search_name():
#Search by last name
print ("Please enter the last name. To return to the search menu, enter 'return'")
name = input()
if name == "return":
return None
else:
return name
def sub_search_number():
#Search by policy number
print ("Please enter the policy number. To return to the search menu, enter 'return'")
policy = input()
if policy == "return":
return None
else:
return int(policy)
#Add Sub Menu(s)
def sub_add_customer():
#Add Customer
foo_customer = customer
print ("If at any point you wish to cancel, enter in 'return'")
questions = ["Please enter in the new customer's last name: ",
"Please enter in the new customer's first name: ",
"Please enter in the new customer's date of birth: ",
"Please enter in the new customer's address: ",
"Please enter in the new customer's city: ",
"Please enter in the new customer's state: ",
"Please enter in the new customer's zip: ",]
answers = []
for foo_question in questions:
foo_answer = input(foo_question)
if foo_answer in ["return", ""]:
return None
else:
answers.append(foo_answer)
foo_customer.last, foo_customer.first, foo_customer.dob, foo_customer.address, foo_customer.city, foo_customer.state, foo_customer.zip = answers
print ()
print (foo_customer.first + " " + foo_customer.last)
print (str(foo_customer.dob))
print (foo_customer.address)
print (foo_customer.city + " " + foo_customer.state + " " + foo_customer.zip)
print ()
print("Are you sure you want to add this customer? y = yes or n = no")
i = False
while i == False:
confirm = input()
if confirm == "n":
i = True
return None
elif confirm == "y":
i = True
return foo_customer
else:
print ("Invalid input.")
def sub_add_policy():
#Add Policy
foo_policy = policy
print ("If at any point you wish to cancel, enter in 'return'")
questions = ["Please enter in the new policy number: ",
"Please enter in the new policy's physical address: ",
"Please enter in the new policy's physical city: ",
"Please enter in the new policy's physical state: ",
"Please enter in the new policy's physical zip: ",
"Please enter in the new policy's premium: ",
"Please enter in the new policy's effective date: ",
"Please enter in the new policy's expiration date: ",
]
answers = []
for foo_question in questions:
foo_answer = input(foo_question)
if foo_answer in ["return", ""]:
return None
else:
answers.append(foo_answer)
foo_policy.number, foo_policy.location, foo_policy.city, foo_policy.state, foo_policy.zip, foo_policy.premium, foo_policy.effective, foo_policy.expiration = answers
print ()
print (foo_policy.number)
print (foo_policy.location + " " + foo_policy.state + " " + foo_policy.zip)
print (foo_policy.premium)
print (str(foo_policy.effective))
print (str(foo_policy.expiration))
print ()
print("Are you sure you want to add this policy? y = yes or n = no")
i = False
while i == False:
confirm = input()
if confirm == "n":
i = True
return None
elif confirm == "y":
i = True
return foo_policy
else:
print ("Invalid input.")
#Remove Sub Menu(s)
def sub_remove_name():
#Search by last name
print ("Please enter the last name. To return to the remove menu, enter 'return'")
name = input()
if name == "return":
return None
else:
return name
def sub_remove_number():
#Search by policy number
print ("Please enter the policy number. To return to the remove menu, enter 'return'")
policy = input()
if policy == "return":
return None
else:
return int(policy)
#The main boolean should always be true until
#The program closes
main = True
#These booleans will determine which main menu will be shown
main_bool = False
search_bool = True
add_bool = True
remove_bool = True
while main == True:
if main_bool == False:
#Main Menu - Main
while main_bool == False:
main_int = main_menu()
if main_int == 1:
#Go to: Main Menu - Search
search_bool = False
main_bool = True
elif main_int == 2:
#Go to: Main Menu - Add
add_bool = False
main_bool = True
elif main_int == 3:
#Go to: Main Menu - Remove
remove_bool = False
main_bool = True
else:
print ("Invalid Input.")
elif search_bool == False:
#Main Menu - Search
while search_bool == False:
search_int = search_menu()
if search_int == 1:
#Go To: Sub Menu - Search By Last Name
search_last = False
while search_last == False:
last_int = sub_search_name()
search_last = True
elif search_int == 2:
#Go To: Sub Menu - Search By Policy Number
search_policy = False
while search_policy == False:
policy_int = sub_search_number()
search_policy = True
elif search_int == 3:
#Return to the Main Menu - Main
main_bool = False
search_bool = True
else:
print ("Invalid Input.")
elif add_bool == False:
#Main Menu - Add
while add_bool == False:
add_int = add_menu()
if add_int == 1:
#Go To: Sub Menu - Add Customer
customer_bool = False
while customer_bool == False:
foo_customer = sub_add_customer()
customer_bool = True
elif add_int == 2:
#Go To: Sub Menu - Add Policy
policy_bool = False
while policy_bool == False:
foo_policy = sub_add_policy()
policy_bool = True
elif add_int == 3:
#Return to the Main Menu - Main
main_bool = False
add_bool = True
else:
print ("Invalid Input.")
elif remove_bool == False:
#Main Menu - Remove
while remove_bool == False:
remove_int = remove_menu()
if remove_int == 1:
#Go To: Sub Menu - Remove By Last Name
search_last = False
while search_last == False:
last_int = sub_remove_name()
elif remove_int == 2:
#Go To: Sub Menu - Remove By Policy Number
search_policy = False
while search_policy == False:
policy_int = sub_remove_number()
search_policy = True
elif remove_int == 3:
main_bool = False
remove_bool = True
else:
print ("Invalid Input.")
I haven't figured out to properly parse data types yet. Right now, for example if I return an integer I'm just calling int(<string>). That's the same as calling CInt(<string>) in vb.net. I need to find a TryParse or something to that effect.
Since I've set up Google Analytics I've had 11 people visit my snippet website! I feel pretty cool knowing I made my own website 8^]
A band of one plays on.
Did I miss something? I went to look at something in the MSDN library today and the default VS option it gave me was VS 2013.
Is there now a VS 2013 and if so... why?!
Yes, there is. I just got an email from MS about it. I believe it has to do with the rapidly changing face of Win8. The new tools are for Win8 development.
Other than that I would guess it would be to generate new revenue.
The post race will never die.
Banana banana, banana banana, :D
I have nothing to say to that, so I'll not say it here.
Debug this:
Its a fun little console app game.Code:Module Module1
Private tmr As New Timers.Timer
Private s As New Snake
Private grid As New Rectangle
Private playing As Boolean = False
Sub Main()
AddHandler tmr.Elapsed, AddressOf tmr_tick
grid.location = New Point(0, 0)
grid.size = New Size(15, 15)
Call NewGame()
Do Until True = False
If playing = False AndAlso Console.ReadKey(True).Key = ConsoleKey.Spacebar Then
playing = True
tmr.Start()
ElseIf playing = True AndAlso Console.ReadKey(True).Key = ConsoleKey.LeftArrow Then
s.direction = Direction.Left
ElseIf playing = True AndAlso Console.ReadKey(True).Key = ConsoleKey.RightArrow Then
s.direction = Direction.Right
ElseIf playing = True AndAlso Console.ReadKey(True).Key = ConsoleKey.UpArrow Then
s.direction = Direction.Up
ElseIf playing = True AndAlso Console.ReadKey(True).Key = ConsoleKey.DownArrow Then
s.direction = Direction.Down
End If
Loop
End Sub
Private Sub tmr_tick(sender As Object, e As Timers.ElapsedEventArgs)
s.prior_location = s.location
Select Case s.direction
Case Direction.Left
s.location = New Point(s.prior_location.x - 1, s.prior_location.y)
Case Direction.Right
s.location = New Point(s.prior_location.x + 1, s.prior_location.y)
Case Direction.Up
s.location = New Point(s.prior_location.x, s.prior_location.y - 1)
Case Direction.Down
s.location = New Point(s.prior_location.x, s.prior_location.y + 1)
End Select
Console.CursorLeft = s.prior_location.x
Console.CursorTop = s.prior_location.y
Console.Write(" ")
'Collision!
If grid.IntersectsWith(s.location) Then
playing = False
tmr.Stop()
Call NewGame()
End If
Call DrawSnake(s)
End Sub
Private Sub NewGame()
playing = False
Call DrawRect(grid.location, grid.size)
With s
.direction = Direction.Right
.location = New Point(1, 1)
.prior_location.x = Nothing
.prior_location.y = Nothing
.speed = 250
End With
tmr.Interval = s.speed
End Sub
Private Sub DrawRect(ByVal pt As Point, ByVal siz As Size)
Dim x, y, wid, hei As Integer
x = pt.x : y = pt.y
wid = siz.width : hei = siz.height
Console.ForegroundColor = ConsoleColor.Green
Console.CursorLeft = x
Console.CursorTop = y
'Draw the top line
For start As Integer = 0 To wid
Console.Write("-")
Next
Console.CursorLeft = x
Console.CursorTop = y + 1
'Draw the left line
For start As Integer = 0 To hei - 2
Console.Write("|")
Console.CursorLeft -= 1
Console.CursorTop += 1
Next
Console.CursorLeft = x
Console.CursorTop = y + hei
'Draw the bottom line
For start As Integer = 0 To wid
Console.Write("-")
Next
Console.CursorLeft = x + wid
Console.CursorTop = y + 1
'Draw the right line
For start As Integer = 0 To hei - 2
Console.Write("|")
Console.CursorLeft -= 1
Console.CursorTop += 1
Next
End Sub
Private Sub DrawSnake(ByVal snake As Snake)
If snake.prior_location.x <> Nothing AndAlso snake.prior_location.y <> Nothing Then
Console.CursorLeft = snake.prior_location.x
Console.CursorTop = snake.prior_location.y
Console.Write("")
End If
Console.CursorLeft = snake.location.x
Console.CursorTop = snake.location.y
Console.Write("@")
End Sub
Structure Point
Public x As Integer
Public y As Integer
Sub New(p1 As Integer, p2 As Integer)
Me.x = p1
Me.y = p2
End Sub
End Structure
Structure Size
Public width As Integer
Public height As Integer
Sub New(s1 As Integer, s2 As Integer)
Me.width = s1
Me.height = s2
End Sub
End Structure
Structure Rectangle
Public location As Point
Public size As Size
Public Function IntersectsWith(ByVal pt As Point) As Boolean
If pt.x <= location.x OrElse pt.x >= location.x + size.width Then
Return True
ElseIf pt.y < location.y OrElse pt.y >= location.y + size.height Then
Return True
Else
Return False
End If
End Function
End Structure
Enum Direction
Up
Down
Left
Right
End Enum
Structure Snake
Public location As Point
Public prior_location As Point
Public direction As Direction
Public speed As Integer
End Structure
End Module
Did you make a snake game? Where's the part where it downloads spyware onto the users computer?
Ha, it's kind of like snake only the snake doesn't grow. It's just a stay in bounds game. And I don't know how to make spyware, nor do I want to know how.
Various people have made snake games over the years, but due to that one infamous thread (probably the most entertaining thread in the history of this site), whenever anybody mentions a snake game I always expect it to be a joke.
How I made date trial on vb6 PLZ Help .
First, upgrade to visual basic.net. Next post a thread in the vb.net section :]
Nah I'm joking(but not really). I have no idea as I've never worked with vb6.
And by date trial I assume you mean a trial period you can use your program before you have to purchase a product key or something along those lines.
Or am I off?
I mean I know I'm off, but am I off on your question?
At times it might seem like you are all by yourself in this thread - but do realize - we are watching you...
That last one is my favorite because it reminds me of my brother. Lol.
I'm sure I've just been placed on a "Watch List".
Man, they will be super bored!
Beginning of Day - 8:29: Inactivity
8:30 - 5:28: Vbforums
5:29 - 5:30: Work
5:31 - End Of Day: Inactivity
I am trying to come up with some kind of joke about watch lists, but it's just not happening for me. There should be a joke there since watch has several different meanings, but nothing seems worth saying.
On the other hand, is it possible to come up with a programming object called a Watch List? Perhaps it would be lit a List(of T) that raised events when items were added and removed. Such a thing probably exists, but if not, it could reasonably be called a Watch List.