Logic Help... PLEASE!

  • Thread starter Thread starter ukjock
  • Start date Start date
U

ukjock

Hi guys and Gals I need some serious help please. I can not get my
head around this problem.

At work we have a BBC Acorn computer (yep, I know what yer thinking),
and for the past month I have decided to re-write the software and
replace the Acorn with a p.c. with new software

The BBC is used for displaying callers to the host of a show. But I am
difficulty figuring out how the company wrote a bit of the software.

http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/bbcacorn.jpg
Down the left is the Line number, to the right is the Callers Details,
and to the right is the order that they called in on.

So it doesn't matter what line they call in on, they will always get
the next available letter. But when you delete the caller the letter
is taken away and then given to the next letter.

So if you delete Line 1. Marc-Coat-Football A
then Donald-Glas-Oneil then loses the B and becomes A,
Dougie-Dundee-Hibs then loses the C and becomes B,
etc. etc.

My GUI looks like this:

[img:9e2f161115]http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/1.jpg[/img:9e2f161115]

Where the Yellow Diamonds are, is where I want to place the letters.
The Diamonds are just labels with an imagebackground.

Any help in figuring out the logic to the letters is much appreciated.
I have been sat for the past 5 hours trying to figure out how to
accomplish this.

Thanks for reading, and hopefully your help.

Chris
 
Well, congratulations on having the fantastic luck to be working on a
replacement of a BBC Acorn. I really cannot beleive this is happening in
2004, almost twenty years after they stopped production of this model.
Amazing. However.

PSEUDO CODE

'When Caller is Deleted

For Each Caller In CallerCollection

Decrement Caller Letter by one, IE if Letter is B, then B becomes A

.....

Regards - OHM


















Hi guys and Gals I need some serious help please. I can not get my
head around this problem.

At work we have a BBC Acorn computer (yep, I know what yer thinking),
and for the past month I have decided to re-write the software and
replace the Acorn with a p.c. with new software

The BBC is used for displaying callers to the host of a show. But I am
difficulty figuring out how the company wrote a bit of the software.

http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/bbcacorn.jpg
Down the left is the Line number, to the right is the Callers Details,
and to the right is the order that they called in on.

So it doesn't matter what line they call in on, they will always get
the next available letter. But when you delete the caller the letter
is taken away and then given to the next letter.

So if you delete Line 1. Marc-Coat-Football A
then Donald-Glas-Oneil then loses the B and becomes A,
Dougie-Dundee-Hibs then loses the C and becomes B,
etc. etc.

My GUI looks like this:

[img:9e2f161115]http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/1.jpg[/im
g:9e2f161115]

Where the Yellow Diamonds are, is where I want to place the letters.
The Diamonds are just labels with an imagebackground.

Any help in figuring out the logic to the letters is much appreciated.
I have been sat for the past 5 hours trying to figure out how to
accomplish this.

Thanks for reading, and hopefully your help.

Chris



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the
World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized
Servers - Total Privacy via Encryption =---
 
Oh yeah, you will need a last letter Static Variable to keep a record of
your last used Letter.

So . . . .

DeleteCaller( CallerName )
' Delete Caller
' Decrement All Letters
' Should Decrement Last Letter

AddCaller( CallerName )
' AddName Using Last Letter
' IncrementLastLetterUsed

Regards - OHM




Well, congratulations on having the fantastic luck to be working on a
replacement of a BBC Acorn. I really cannot beleive this is happening
in 2004, almost twenty years after they stopped production of this
model. Amazing. However.

PSEUDO CODE

'When Caller is Deleted

For Each Caller In CallerCollection

Decrement Caller Letter by one, IE if Letter is B, then B becomes
A

....

Regards - OHM


















Hi guys and Gals I need some serious help please. I can not get my
head around this problem.

At work we have a BBC Acorn computer (yep, I know what yer thinking),
and for the past month I have decided to re-write the software and
replace the Acorn with a p.c. with new software

The BBC is used for displaying callers to the host of a show. But I
am difficulty figuring out how the company wrote a bit of the
software.

http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/bbcacorn.jpg
Down the left is the Line number, to the right is the Callers
Details, and to the right is the order that they called in on.

So it doesn't matter what line they call in on, they will always get
the next available letter. But when you delete the caller the letter
is taken away and then given to the next letter.

So if you delete Line 1. Marc-Coat-Football A
then Donald-Glas-Oneil then loses the B and becomes A,
Dougie-Dundee-Hibs then loses the C and becomes B,
etc. etc.

My GUI looks like this:
[img:9e2f161115]http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/1.jpg[/im
g:9e2f161115]

Where the Yellow Diamonds are, is where I want to place the letters.
The Diamonds are just labels with an imagebackground.

Any help in figuring out the logic to the letters is much
appreciated. I have been sat for the past 5 hours trying to figure
out how to accomplish this.

Thanks for reading, and hopefully your help.

Chris



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the
World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized
Servers - Total Privacy via Encryption =---
 
Hello Chris

Check out the code below. It provides the functionality you needed. Also
there is test code that you can plop onto a form with a listbox and a button
on it.


--
Ibrahim Malluf
http://www.malluf.com
==============================================
MCS Data Services Code Generator
http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
==============================================
Pocket PC Return On Investment Calculator
Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx


ukjock said:
Hi guys and Gals I need some serious help please. I can not get my
head around this problem.

At work we have a BBC Acorn computer (yep, I know what yer thinking),
and for the past month I have decided to re-write the software and
replace the Acorn with a p.c. with new software

The BBC is used for displaying callers to the host of a show. But I am
difficulty figuring out how the company wrote a bit of the software.

http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/bbcacorn.jpg
Down the left is the Line number, to the right is the Callers Details,
and to the right is the order that they called in on.

So it doesn't matter what line they call in on, they will always get
the next available letter. But when you delete the caller the letter
is taken away and then given to the next letter.

So if you delete Line 1. Marc-Coat-Football A
then Donald-Glas-Oneil then loses the B and becomes A,
Dougie-Dundee-Hibs then loses the C and becomes B,
etc. etc.

My GUI looks like this:

[img:9e2f161115]http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/1.jpg[/im
g:9e2f161115]

Where the Yellow Diamonds are, is where I want to place the letters.
The Diamonds are just labels with an imagebackground.

Any help in figuring out the logic to the letters is much appreciated.
I have been sat for the past 5 hours trying to figure out how to
accomplish this.

Thanks for reading, and hopefully your help.

Chris



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---


Public Class clsCaller

'================================

'very simple class for holding

'caller information

'================================

Private _Callername As String

Private _CalllerLine As Integer

Private _CallerQue As Char

'constructor requires a name and the line number

Public Sub New(ByVal Name As String, ByVal Line As Integer)

Me._Callername = Name

Me._CalllerLine = Line

End Sub

Public Property CallerName() As String

Get

Return Me._Callername

End Get

Set(ByVal Value As String)

Me._Callername = Value

End Set

End Property

Public Property CallerLine() As Integer

Get

Return Me._CalllerLine

End Get

Set(ByVal Value As Integer)

Me._CalllerLine = Value

End Set

End Property

Public Property CallerQueue() As Char

Get

Return Me._CallerQue

End Get

Set(ByVal Value As Char)

Me._CallerQue = Value

End Set

End Property

End Class

Public Class clsCallers : Implements IEnumerable

Dim _MyCallers As New ArrayList(25)

'adds a caller to the que

Public Function AddCaller(ByVal Name As String, ByVal Line As Integer)

Me._MyCallers.Add(New clsCaller(Name, Line))

End Function

'removes a caller from the que

Public Sub RemoveCaller(ByVal Caller As clsCaller)

Me._MyCallers.Remove(Caller)

End Sub

'gets a caller from the list by index

Public Overloads ReadOnly Property Caller(ByVal Index As Integer) As
clsCaller

Get

Dim MyCaller As clsCaller = DirectCast(Me._MyCallers(Index), clsCaller)

MyCaller.CallerQueue = Chr(65 + Index)

Return MyCaller

End Get

End Property



'gets a caller by queue letter

Public Overloads ReadOnly Property Caller(ByVal Queue As Char) As clsCaller

Get

Queue = Queue.ToUpper(Queue)

If Queue >= "A" Or Queue <= "Z" Then

Return Me._MyCallers(Asc(Queue) - 65)

End If

End Get

End Property



'this makes the Callers class enumerable. So you can get each caller element
in a For-Each structure

Public Function GetEnumerator() As System.Collections.IEnumerator Implements
System.Collections.IEnumerable.GetEnumerator

Return New CallerCollection(Me._MyCallers)

End Function

End Class



'this class provides the enumeration capability for the Callers class

Class CallerCollection : Implements IEnumerator

Private _MyCallers As ArrayList

Private _Index As Integer = -1

Public Sub New(ByVal Callers As ArrayList)

Me._MyCallers = Callers

End Sub

Public ReadOnly Property Current() As Object Implements
System.Collections.IEnumerator.Current

Get

Dim MyCaller As clsCaller = DirectCast(Me._MyCallers(Me._Index), clsCaller)

MyCaller.CallerQueue = Chr(65 + Me._Index)

Return MyCaller

End Get

End Property

Public Function MoveNext() As Boolean Implements
System.Collections.IEnumerator.MoveNext

If Me._Index >= Me._MyCallers.Count - 1 Then Return False

Me._Index += 1

Return True

End Function

Public Sub Reset() Implements System.Collections.IEnumerator.Reset

Me._Index = 0

End Sub

End Class

Drop this code in a form that has a listbox and a command button

Private _Mycallers As clsCallers

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me._Mycallers = New clsCallers

With Me._Mycallers

..AddCaller("Joe Caller", 1)

..AddCaller("Bill Called", 2)

..AddCaller("Harry Calling", 3)

..AddCaller("Mary Online", 4)

End With



For Each MyCaller As clsCaller In Me._Mycallers

Me.ListBox1.Items.Add(MyCaller.CallerLine & vbTab & MyCaller.CallerQueue &
vbTab & MyCaller.CallerName)

Next

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim Caller As clsCaller

Caller = Me._Mycallers.Caller(1)

Me._Mycallers.RemoveCaller(Caller)

Me.ListBox1.Items.Clear()

For Each MyCaller As clsCaller In Me._Mycallers

Me.ListBox1.Items.Add(MyCaller.CallerLine & vbTab & MyCaller.CallerQueue &
vbTab & MyCaller.CallerName)

Next

End Sub
 
I believe that In the Button1_Click Event

Caller = Me._Mycallers.Caller(1)

should be (zero based arrays)

Caller = Me._Mycallers.Caller(0)


Also Me._MyCallers(Asc(Queue) - 65) needs a DirectCast (per Option Strict)
Public Overloads ReadOnly Property Caller(ByVal Queue As Char) As
clsCaller

Get

Queue = Queue.ToUpper(Queue)

If Queue >= "A" Or Queue <= "Z" Then

Return DirectCast(Me._MyCallers(Asc(Queue) - 65), clsCaller)

End If

End Get

End Property

IbrahimMalluf said:
Hello Chris

Check out the code below. It provides the functionality you needed. Also
there is test code that you can plop onto a form with a listbox and a button
on it.


--
Ibrahim Malluf
http://www.malluf.com
==============================================
MCS Data Services Code Generator
http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
==============================================
Pocket PC Return On Investment Calculator
Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx


ukjock said:
Hi guys and Gals I need some serious help please. I can not get my
head around this problem.

At work we have a BBC Acorn computer (yep, I know what yer thinking),
and for the past month I have decided to re-write the software and
replace the Acorn with a p.c. with new software

The BBC is used for displaying callers to the host of a show. But I am
difficulty figuring out how the company wrote a bit of the software.

http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/bbcacorn.jpg
Down the left is the Line number, to the right is the Callers Details,
and to the right is the order that they called in on.

So it doesn't matter what line they call in on, they will always get
the next available letter. But when you delete the caller the letter
is taken away and then given to the next letter.

So if you delete Line 1. Marc-Coat-Football A
then Donald-Glas-Oneil then loses the B and becomes A,
Dougie-Dundee-Hibs then loses the C and becomes B,
etc. etc.

My GUI looks like this:
[img:9e2f161115]http://www.ch010a0005.pwp.blueyonder.co.uk/extreme/1.jpg[/im
g:9e2f161115]

Where the Yellow Diamonds are, is where I want to place the letters.
The Diamonds are just labels with an imagebackground.

Any help in figuring out the logic to the letters is much appreciated.
I have been sat for the past 5 hours trying to figure out how to
accomplish this.

Thanks for reading, and hopefully your help.

Chris



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via
Encryption
=---


Public Class clsCaller

'================================

'very simple class for holding

'caller information

'================================

Private _Callername As String

Private _CalllerLine As Integer

Private _CallerQue As Char

'constructor requires a name and the line number

Public Sub New(ByVal Name As String, ByVal Line As Integer)

Me._Callername = Name

Me._CalllerLine = Line

End Sub

Public Property CallerName() As String

Get

Return Me._Callername

End Get

Set(ByVal Value As String)

Me._Callername = Value

End Set

End Property

Public Property CallerLine() As Integer

Get

Return Me._CalllerLine

End Get

Set(ByVal Value As Integer)

Me._CalllerLine = Value

End Set

End Property

Public Property CallerQueue() As Char

Get

Return Me._CallerQue

End Get

Set(ByVal Value As Char)

Me._CallerQue = Value

End Set

End Property

End Class

Public Class clsCallers : Implements IEnumerable

Dim _MyCallers As New ArrayList(25)

'adds a caller to the que

Public Function AddCaller(ByVal Name As String, ByVal Line As Integer)

Me._MyCallers.Add(New clsCaller(Name, Line))

End Function

'removes a caller from the que

Public Sub RemoveCaller(ByVal Caller As clsCaller)

Me._MyCallers.Remove(Caller)

End Sub

'gets a caller from the list by index

Public Overloads ReadOnly Property Caller(ByVal Index As Integer) As
clsCaller

Get

Dim MyCaller As clsCaller = DirectCast(Me._MyCallers(Index), clsCaller)

MyCaller.CallerQueue = Chr(65 + Index)

Return MyCaller

End Get

End Property



'gets a caller by queue letter

Public Overloads ReadOnly Property Caller(ByVal Queue As Char) As clsCaller

Get

Queue = Queue.ToUpper(Queue)

If Queue >= "A" Or Queue <= "Z" Then

Return Me._MyCallers(Asc(Queue) - 65)

End If

End Get

End Property



'this makes the Callers class enumerable. So you can get each caller element
in a For-Each structure

Public Function GetEnumerator() As System.Collections.IEnumerator Implements
System.Collections.IEnumerable.GetEnumerator

Return New CallerCollection(Me._MyCallers)

End Function

End Class



'this class provides the enumeration capability for the Callers class

Class CallerCollection : Implements IEnumerator

Private _MyCallers As ArrayList

Private _Index As Integer = -1

Public Sub New(ByVal Callers As ArrayList)

Me._MyCallers = Callers

End Sub

Public ReadOnly Property Current() As Object Implements
System.Collections.IEnumerator.Current

Get

Dim MyCaller As clsCaller = DirectCast(Me._MyCallers(Me._Index), clsCaller)

MyCaller.CallerQueue = Chr(65 + Me._Index)

Return MyCaller

End Get

End Property

Public Function MoveNext() As Boolean Implements
System.Collections.IEnumerator.MoveNext

If Me._Index >= Me._MyCallers.Count - 1 Then Return False

Me._Index += 1

Return True

End Function

Public Sub Reset() Implements System.Collections.IEnumerator.Reset

Me._Index = 0

End Sub

End Class

Drop this code in a form that has a listbox and a command button

Private _Mycallers As clsCallers

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me._Mycallers = New clsCallers

With Me._Mycallers

.AddCaller("Joe Caller", 1)

.AddCaller("Bill Called", 2)

.AddCaller("Harry Calling", 3)

.AddCaller("Mary Online", 4)

End With



For Each MyCaller As clsCaller In Me._Mycallers

Me.ListBox1.Items.Add(MyCaller.CallerLine & vbTab & MyCaller.CallerQueue &
vbTab & MyCaller.CallerName)

Next

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim Caller As clsCaller

Caller = Me._Mycallers.Caller(1)

Me._Mycallers.RemoveCaller(Caller)

Me.ListBox1.Items.Clear()

For Each MyCaller As clsCaller In Me._Mycallers

Me.ListBox1.Items.Add(MyCaller.CallerLine & vbTab & MyCaller.CallerQueue &
vbTab & MyCaller.CallerName)

Next

End Sub
 
ukjock said:
Down the left is the Line number, to the right is the Callers Details,
and to the right is the order that they called in on.

So it doesn't matter what line they call in on, they will always get
the next available letter. But when you delete the caller the letter
is taken away and then given to the next letter.

I note that you received replies but may I suggest that there may be a
design flaw. The user scans the list looking for the letter "A" on the
right (somewhere) and then they choose a line on a phone using the number on
the left.

Shouldn't they rather be being told which line to pickup next? The thing is
a queue... you simply eliminate the letter and always add the caller's name
and the phone line to the end of the queue as they call in. Now even if you
had 30 or 300 phone lines nobody scans anything, they simply look at the
first entry and choose that line.

From a solutions standpoint, using letters means you're locked into 26
entries max but more importantly the user has to find the next one. That's
what computers are for :-)
Tom
 
Back
Top