View Single Post
Old 09-25-2012, 07:36 AM   PM User | #7
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by Liz.2012 View Post
Ok so I'm pretty sure my error lies here -
var = if (numPeople <=30 && courseChoice ==1);
{totOnecourse}
I think you are in serious trouble and seem to be very confused in your understanding of the basics of Javascript coding, such as the use of the var keyword. I don't see these as "silly errors" - I see these as lack of comprehension. And for the second time you seem to have ignored my advice regarding the position of opening braces and use of semi-colons. Why should I waste more time on this?

In the code I gave you in Post #2
people is the number of people (1-60)
c is the number of courses (1 or 2).

So there are four possible outcomes:-

people <=30 and c == 1
people >30 and c == 1
people <=30 and c == 2
people >30 and c == 2

so

if (people <=30 && c == 1) {
tot = people * 15; // or whatever the cost per head is.
}
if (people <= 30 && c == 2) {
tot = people * 25; // or whatever the cost per head is.
}

One more time, it is not really in your best interests that others do your all or most homework for you. Your teacher may gain a false and exaggerated idea of your programming capabilities and so not offer you the support you need. Also, if you hand in other people's work which you do not completely understand, then you will start to fall behind and your difficulties will increase.

I must ask to excused from taking this topic any further. Discuss your problems with your teacher.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.

Last edited by Philip M; 09-25-2012 at 08:34 AM.. Reason: Correct typos
Philip M is offline   Reply With Quote