samhor — 2012-03-19T18:20:48-04:00 — #1
I have made the below code but i want to add something extra to it. I have tried to do it several times already but the code just seems to stop working
What i need it to do is to keep asking the user to enter the CD Title and CD Cost repeatedly and to total all the CD Costs together.
a=(prompt('please enter the CD Title:',0)); // enter the cd title promt
b=parseFloat(prompt('please enter the CD Cost:',0)); // enter the cd cost promt
document.writeln(' your CD Title is: <b>' + a + '</b>'); //write the cd title to the screen in bold
document.writeln(' your CD Cost is: <b>' + b + '</b>'); //write the cd cost to the screen
Customer wants to buy X CD's.
The prompt will appear X times untill the customer has no more CD's they want to buy
All the CD Titles & CD Costs should be written to the screen
your CD Title is: RnB Classic Vol 1 your CD Cost is: 1.00
your CD Title is: RnB Classic Vol 2 your CD Cost is: 1.00
your CD Title is: RnB Classic Vol 3 your CD Cost is: 1.00
Total Cost 3.00
Can anyone help?
paul_wilkins — 2012-03-19T19:42:27-04:00 — #2
You will want to make inquiries with your class instructor about how to use a for loop.
samhor — 2012-03-19T19:46:09-04:00 — #3
No class instructor at all but thanks for the assumption. I am just practicing my js for a home project of mine.
paul_wilkins — 2012-03-20T00:28:26-04:00 — #4
Also, We have a section of links and resources that contains beginner articles, and other resources that you can use to further your education.