Algorithms

Peder

Hobbit
Joined
Oct 16, 2006
Messages
9,397
Reaction score
64
Location
Pretoria South Africa
Hi Guys i am busy with a Computer studies Task and was wondering what kind of loop i should make...

Okay so i have to explain in Algorithm how to enter data into a database.

So what i have so far is:
Open Database
Click options
Click enable Content
Click ok
Login with Username and Password
Goto New Customer Order
Choose Customer
If Customer ID does not exist
Then open add client
End if
If Customer ID does exist
Choose Customer ID
If product >1 then
Choose product
Choose Quantity of Product


Now the bolded part has to be repeated a certain number of times depending on how many parts the person wants, what is the best way to make it repeat? algorithmically?

Thanx
hope someone can help me quick
Peder
 
Ok so this is what i got. will it work?

Code:
Open Database
Click options 
Click enable Content 
Click ok
Login with Username and Password
Goto New Customer Order
Choose Customer
If Customer ID does not exist 
Then open add client
End if
If Customer ID does exist 
Choose Customer ID
If product >1 then
Choose product
Choose Quantity of Product
Repeat until all data is entered
Else if product =1
Then  Choose product
Choose Quantity of Product
End if
Click Shipping information
Choose Shipping company 
If Customer Pick-Up 
Then Click payment information
Else Enter in Shipping Data
Click Payment information
Choose payment type
Choose payment Date
Click Create Invoice
Right-Click Print
Choose printer
Click ok
Close invoice window
Click Ship Order
Click Complete Order
End if
 
Why would you want to loop it?

I admit I don't know what you're talking about re: Explaining in Algorithm how your program will work, but I'd think that your Computer Studies course is a bit outdated if it's top-down/enter all data at once then only save it to the database type work you do.

Why would you want to have to click Options and then Enable Content each time when capturing work every time?

Code:
If Customer ID does not exist 
Then open add client
[b]Else[/b]
Choose Customer ID
End if

I also don't understand the logic. Why would product be 1? What conditions are set for it? is product a bit (boolean? true/false?)? I assume it's the QTY. Why would you then want to do the exact same thing, only repeated, when there is more than 1 product?

Perhaps rename your variables. Instead of going "product" say "productQTY" and explain more in terms of WHY you have that in there?

Now that I went through it again, I assume this is a step by step type manual for entering data? So I assume they have a spreadsheet that can contain more than 1 product hence product>1 check?

In terms of user friendly-ness (out of 10) I'd give it a 3. Just the number of clicks to do something is a bit daunting. Especially opening it up in the first place. Then again, you didn't explain if this is a standalone program or that it's a module part of a bigger program, hence the Enable Content click each time.

I'd also try and structure it to read better:

Code:
Open Database
         Click options 
              Click enable Content 
                   Click ok
                   Login with Username and Password
                   Goto New Customer Order
                             Choose Customer
                             If Customer ID does not exist 
                                       Then open add client
                             End if
                             If Customer ID does exist 
                                       Choose Customer ID
                                        If product >1 then
                                               Choose product
                                               Choose Quantity of Product
                                               Repeat until all data is entered
                                        Else if product =1
                                               Then  Choose product
                                                Choose Quantity of Product
                                        End if
                              Click Shipping information
                                     Choose Shipping company 
                                     If Customer Pick-Up 
                                          Then Click payment information
                                     Else Enter in Shipping Data
                             Click Payment information
                                   Choose payment type
                                   Choose payment Date
                                   Click Create Invoice
                             Right-Click Print
                                      Choose printer
                                      Click ok
                 Close invoice window
                 Click Ship Order
                 Click Complete Order
         End if

And I think you forgot to Close Database & a few mis placed End If's and Then's ;) I know its pseudo code to explain the structure, but if you do pseudo code it's easier if you stick to the structure you'll program it in. Not sure if anyone might agree
 
Yes. I agree. I can't read code (pseudo or not) that doesn't follow standard indentation. I then tend to disregard it completely. As Acid already mentioned, it's a bit difficult to help you out without a bit more detail to the spec. Maybe we could educate you in a better approach if you could post more requirements to the assignment?
 
What they said. I skimmed past your posts' code because it was too difficult to read in this format.
 
Its a project on Computerisation (making a previously uncomputerized company computerized) course... ( I Personally think its outdated but yeah)

What I had to do was Create a Database, then from the database where you input data into the forms. So you have to to input something in "baby steps" as they say, thats what the loops were for, because in the product you had to put more than one product in. But i understand i should have put product QTY. not product.
 
Its a project on Computerisation (making a previously uncomputerized company computerized) course... ( I Personally think its outdated but yeah)

What I had to do was Create a Database, then from the database where you input data into the forms. So you have to to input something in "baby steps" as they say, thats what the loops were for, because in the product you had to put more than one product in. But i understand i should have put product QTY. not product.

Re-think your steps as well.

Why would you want the user to click on Enable content and fill in a password/login each time you want them to capture an invoice? because currently after they closed the invoice screen, they need to do that to capture a new invoice
 
Re-think your steps as well.

Why would you want the user to click on Enable content and fill in a password/login each time you want them to capture an invoice? because currently after they closed the invoice screen, they need to do that to capture a new invoice

the examples all had them going in every time.

I just write down those algorithms don't actually "use" them.

Well i sent in the project already. just the thought of seeing that project makes me sick atm since i worked the whole day yesterday on it...
 
is computerisation even a word?:P i believe its computerization
 
the examples all had them going in every time.

I just write down those algorithms don't actually "use" them.

Well i sent in the project already. just the thought of seeing that project makes me sick atm since i worked the whole day yesterday on it...

If I can give you a nugget of my years of real world experience

**** the examples :)

I recently had a programmer who used the basis of the old program and modified it to fit into the new "program". Total disaster. Instead of re-writing it properly in less time and less bugs...

So sure, base your initial ideas off of the example, but never be afraid to think for yourself and improve on it. Get rid of the Options -> Enable Content -> Login. Login -> Create Invoice -> Print Invoice -> Create Invoice [repeat]

I'm really not sure which course you're on but the teacher would be a total ****ing idiot if he penalised you on streamlining the user experience while maintaining the structure of the program algorithm :)
 
I recently had a programmer who used the basis of the old program and modified it to fit into the new "program". Total disaster. Instead of re-writing it properly in less time and less bugs...

lol. gets even better when new programs are hacked to work with the old improved code...
 
lol. gets even better when new programs are hacked to work with the old improved code...

Seriously, I could re-do the entire ****ing thing in a week, where it took him 4 months and handed over to me to fix all the bugs.

THAT is lazy work. Non-creative thinking bull**** "Drone"

I ask a million questions beforehand to get a complete understanding about the business model and thinking behind the website before I even start one line of code.

Last week I re-wrote an entire module someone was doing for 3 weeks and haven't completed it in less than 12 hours.... and it was completed and WORKED.

Why do these leeches get paid good money to **** around with this?

I haven't even touched that code since last week and they've been doing user acceptance testing since Monday...
 
Geez Acid... I see a lot of **** in your posts today. A bit agitated, are we? :p

**** yea... people irratate the **** out of me when they pretend like they ****ing deserve to be paid a salary for mediocare and sub par work I need to ****ing fix anyway. And then the pressure is on me to reach deadline with my own **** as well?

I'm going to burn this place down if I find out that these ****-heads get paid more than I do for the crap they spew.

Hell, I even lead the BA's sometime... think about **** they should've thought about and then they're like "oh, I'll have to get back to you"

WTF!!!!! And those guys went to school for **** like that.... I went to school because I was bored between the ages of 1-18
 
Last edited:
**** yea... people irratate the **** out of me when they pretend like they ****ing deserve to be paid a salary for mediocare and sub par work I need to ****ing fix anyway. And then the pressure is on me to reach deadline with my own **** as well?

I'm going to burn this place down if I find out that these ****-heads get paid more than I do for the crap they spew.

Hell, I even lead the BA's sometime... think about **** they should've though about and then they're like "oh, I'll have to get back to you"

WTF!!!!! And those guys went to school for **** like that.... I went to school because I was bored between the ages of 1-18

Acid, I feel your pain. Being a senior dev / architect it amazes me sometimes with the **** some these guys put out into testing and prod
 
Hi Guys i am busy with a Computer studies Task and was wondering what kind of loop i should make...

Okay so i have to explain in Algorithm how to enter data into a database.

So what i have so far is:
Open Database
Click options
Click enable Content
Click ok
Login with Username and Password
Goto New Customer Order
Choose Customer
If Customer ID does not exist
Then open add client
End if
If Customer ID does exist
Choose Customer ID
If product >1 then
Choose product
Choose Quantity of Product


Now the bolded part has to be repeated a certain number of times depending on how many parts the person wants, what is the best way to make it repeat? algorithmically?

Thanx
hope someone can help me quick
Peder


Just to clear something up, this approach to what you want do is not an algorithm. Its a process flow. The repeated parts would simply be decision gates, depicting what must be done next. No algorithm that i am aware of is going to help you define user steps.
 
**** yea... people irratate the **** out of me when they pretend like they ****ing deserve to be paid a salary for mediocare and sub par work I need to ****ing fix anyway. And then the pressure is on me to reach deadline with my own **** as well?

I'm going to burn this place down if I find out that these ****-heads get paid more than I do for the crap they spew.

Hell, I even lead the BA's sometime... think about **** they should've thought about and then they're like "oh, I'll have to get back to you"

WTF!!!!! And those guys went to school for **** like that.... I went to school because I was bored between the ages of 1-18

You went to school from the age of 1?! :eek: No wonder you're so cranky...

Oh, and I understand what you're going through. Not having an official title at work, I like to refer to myself as an "Analyst Developer", seeing as I also have to do the BA work. :p
 
Top
Sign up to the MyBroadband newsletter
X