Click to See Complete Forum and Search --> : Javascript Newbie
marrow1a
07-22-2003, 05:03 PM
Hi,
I just started learning Javascript and I'm completely stumped
by this problem, I am trying to write a function that picks out and stores items that have unusual price values ie
$6.17, $7.43 as opposed to the the usual item prices such as $7.95, $7.99
Thanks
Charles
07-22-2003, 05:07 PM
It's easily done using Regular Expressions but:
1) Out of what do you wish to pick them?
2) Where do you wish to store them?
3) What, exactly, is an unusual price?
marrow1a
07-22-2003, 06:13 PM
Hi, thanks for replying
I want to write a algorithm for a function to check for an unspecified amount supermarket items that are priced wrong eg:- a carton of milk is priced wrongly at 2.33 when it should be 2.99,
I want to store the information all the information of the supermarket items as well as the price in an object. I'm really stumped.
Charles
07-22-2003, 09:55 PM
I guess that answers question 2. What about 1 and 3?
marrow1a
07-22-2003, 11:54 PM
Hi,
This is the exercise question.
Write an algorithm for a function which checks for unusual prices. Unusual are prices that supermarkets don't use. Have you ever noticed that milk is never 4.34, it is always 4.50 or 4.99. special offers are normally 3.99 or 3.90 never 3.17. Visit your local supermarket and find out what you need the function to check and what it should set the price to. Store all the information including the price in a Javascript object.
After going the supermarket where should i begin?
Thank you
Charles
07-23-2003, 05:28 AM
Originally posted by marrow1a
After going the supermarket where should i begin?Where I went to school you would be expelled for academic dishonesty, no questions asked. And if I did your homework for you you would certainly be found out.
Start by learning Regular Expressions. Study http://devedge.netscape.com/library/manuals/2000/javascript/1.3/guide/regexp.html, http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/regexp.html and http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/string.html.
marrow1a
07-23-2003, 05:50 AM
Hi, again
Thanks again, this information will be extremely helpful,
you are absolutley right, I apologise for my dishonesty but with these links i should be able to learn enough to get through this problem.
Thanks again