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
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 8 of 8
Thread
-
"I've got a present for ya!" - TTWC
-
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 -
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. -
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 -
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. -
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 -
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
Similar Threads
-
Copy text from website but right click is disabled and JavaScript needed
By coody in forum ComputerReplies: 12Last Post: 1st Feb 2011, 13:56 -
Adobe Javascript 10 question
By jyeh74 in forum Newbie / General discussionsReplies: 3Last Post: 26th Oct 2009, 00:51 -
Javascript/Silverlight, embedding multiple players
By thecoalman in forum ProgrammingReplies: 0Last Post: 4th Mar 2008, 07:00 -
I need urgent help, please! Javascript not working
By rem_2007 in forum ComputerReplies: 4Last Post: 23rd Nov 2007, 09:23 -
Windows utilities to strip Javascript?
By Ai Haibara in forum ComputerReplies: 12Last Post: 22nd Sep 2007, 19:37