VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member TaoTeWingChun's Avatar
    Join Date
    Jan 2005
    Location
    Mahopac, NY
    Search Comp PM
    Hi Guys,

    Sorry for the urgency, I have a niece that needs some JavaScript assistance for a school project, was wondering if anyone could help? It's a simple exercise from what I see, and I would do it myself if I knew JavaScript, but alas I don't.

    Please let me know if you can assist.

    Thanks!

    TTWC
    "I've got a present for ya!" - TTWC
    Quote Quote  
  2. Member TaoTeWingChun's Avatar
    Join Date
    Jan 2005
    Location
    Mahopac, NY
    Search Comp PM
    Here's the exercise:

    1. Develop a program from JavaScript that determines if a client of a department store exceeds the credit limit of the account. For every client these are the facts:
    *Account number or the beginning balance of the month
    * Total of items charged by the client for the month
    * Total of all the credits applied by the account of the client for the month or limit of credit

    The program has to let the entry of every single fact, after getting the new balance (=beginning balance + charges= credit), it has to let loose/release the new balance and determine if the new balance exceeds the limit of the credit; if it does, it has to send a message to the user letting him know that the credit has exceeded.

    And:

    2. Write a Script that looks for a minimum number in a group of whole numbers. We have to let the user enter all the numbers that it wants.

    Any takers?
    "I've got a present for ya!" - TTWC
    Quote Quote  
  3. Greetings Supreme2k's Avatar
    Join Date
    Feb 2003
    Location
    Right Here, Right Now
    Search Comp PM
    You pretty much have the formula done already: charges + balance = new balance

    if new balance > credits then send message
    else repeat (or whatever you want it to do at that point)


    A great site for programming is http://www.w3schools.com/js/default.asp


    for the other, you can use the below code. You can put a routine in there to accept input before doing the sort, rather than pre-defined.


    function asNum(a, b) { return a-b; }

    function getMin(a) {
    var b = a.concat()
    return b.sort(asNum)[0];
    }

    var a = [];
    a[500] = 13;
    a[1000] = 0;
    a[250] = 10;

    alert(getMin(a));

    What you want to do is a basic bubble sort.
    Quote Quote  
  4. Member TaoTeWingChun's Avatar
    Join Date
    Jan 2005
    Location
    Mahopac, NY
    Search Comp PM
    Thanks for the reply, Supreme2K!

    I wish I had the time to do more research on this myself, but these days are very tight with the holidays fast approaching. I was wondering if you could help explain what a "bubble sort" is?

    Also, any ideas how I could structure the code for that first example? The instructions are clear enough, I just don't know anything about JS structures, variables, etc...

    Thanks again for your kind reply!

    Happy Holidays!

    TTWC
    "I've got a present for ya!" - TTWC
    Quote Quote  
  5. Greetings Supreme2k's Avatar
    Join Date
    Feb 2003
    Location
    Right Here, Right Now
    Search Comp PM
    I assume that your niece is in at least high school. Those assignments are pretty advanced for any lower grades.

    I'm surprised they're doing the first assignment in js. PHP or any other database enabled script would be better suited for such a task.

    I f'ing hate school programming assignments. 99% of the time, they make no sense. Especially now, they're often mandatory to make the student "well rounded". What they should be teaching is basic computer skills, and how not to use text-speak.
    Quote Quote  
  6. Member TaoTeWingChun's Avatar
    Join Date
    Jan 2005
    Location
    Mahopac, NY
    Search Comp PM
    My niece is actually trying to finish a college class, and I couldn't agree with you more. The text-speak is completely out of control! And this concept of "the well-rounded" student is a farce.

    Grrr!
    "I've got a present for ya!" - TTWC
    Quote Quote  
  7. VH Veteran jimmalenko's Avatar
    Join Date
    Aug 2003
    Location
    Down under
    Search PM
    I don't mean to be rude, but wouldn't it be more beneficial as a learning exercise for your niece if she actually googled it herself ?
    If in doubt, Google it.
    Quote Quote  
  8. Member TaoTeWingChun's Avatar
    Join Date
    Jan 2005
    Location
    Mahopac, NY
    Search Comp PM
    If this were a class on JavaScript, I'd agree with you, but it isn't, and while she's self-taught for HTML/XML, she has no idea how to begin with JavaScript, and she only needs help with these specific examples so she can be done with this class. Also, the professor assigned each person a different task, and she appears to have gotten the hardest one to complete, which is why I'm asking for assistance on her behalf.

    Cheers!

    TTWC
    "I've got a present for ya!" - TTWC
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!