PDA

View Full Version : Anybody good at Algorithm design?



aintnothang
02-20-2011, 12:51 AM
I need some help on a problem...

jdbnsn
02-20-2011, 01:31 AM
sorry dude, I never did have much rhythm

AmEv
02-20-2011, 01:49 AM
Wow, jd.


Depends on what you mean, hang.

aintnothang
02-20-2011, 02:36 AM
....problem is
problem:

Diamon
02-20-2011, 07:30 AM
Dunno about the programming part but the formula for calculating the price could look something like this:

Variables:


Name: Value: Abbreviation:
750+ square inches 1/0 A
Mahogany 1/0 B
Oak 1/0 C
Cherry 1/0 D
Pine 1/0 E
Drawers 0 to infinite F



175+(A*75)+(B*200)+(C*150)+(D*100)+(E*0)+(F*35)=Pr ice of the desk


EDIT: The text is jumping around like crazy but you get the idea.

EDIT 2: Changed the drawers value range from "1-infinite" to "0-infinite" as NightrainSrt4 suggested.
I didn't read the assignment properly :P

NightrainSrt4
02-20-2011, 11:50 AM
Diamon has it well laid out. But change the 1 in Drawers to be 0, as you can have 0 drawers in the desk. You would initialize everything to zero, and only change the values of the variables the user specifies.

Your instructor should have explained how he wanted the program plan, introduction, etc, as that is the Software Engineering part of the problem, and I'm sure he/she has specific requirements/method of teaching you.

aintnothang
02-20-2011, 05:28 PM
Its an online class with zero direction thanks For the help.

x88x
02-20-2011, 10:19 PM
Or, alternately:

Variables:


Name: Value: Abbreviation:
750+ square inches 1/0 A
WoodType 0/100/150/200 B
Drawers 0 to infinite F



175+(A*75)+B+(F*35)=Price of the desk

Single bigger variable instead of four smaller ones, more complicated code when assigning values, but simpler algorithm when finding end price. It all depends on what is more important in the specific circumstance.


Also, as a side note, that's an absurd pricing criteria. :P (I know, you didn't make it up. Still, it had to be said.)

aintnothang
02-21-2011, 12:15 AM
what should the program plan consist of? Just an explanation of how this algorithm works?

Ichbin
02-21-2011, 04:39 AM
I would usually just explain what the variables mean in my programs,

however writing a field stating where the algo starts and a small explanation shouldn't hurt.