Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com coffee shop calculator.

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 05-07-2012, 05:55 AM PM User | #1 rarjake New to the CF scene   Join Date: May 2012 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts coffee shop calculator. going crazy now. been trying to work on this problem. this is the basis of this espresso costs 1.40 served as shot latte/cappuccino cost the same 8 ouce 1.95 12 ounce 2.35 16 ounce 2.75 american costs 1.20 for first 8 ounces .30 cents for each additional 8 ounce (0.0375 per ounce) final price needs to be taxed 0.055. (have not got that far) Code: ``` Coffee Shop Calculator ``` the espresso cost is the only one that would work. the rest not. i am just in the basics of javescript beginner course, so keep it to the basics of basics. Last edited by VIPStephan; 05-07-2012 at 10:56 AM.. Reason: added code BB tags
 05-07-2012, 06:12 AM PM User | #2 xelawho Senior Coder     Join Date: Nov 2010 Posts: 2,591 Thanks: 54 Thanked 477 Times in 475 Posts the first thing you need to do is to be able to look at your code in a debugger. I like the one in Chrome (spanner>tools>javascript console).
 05-07-2012, 08:27 AM PM User | #3 Philip M Supreme Master coder!     Join Date: Jun 2002 Location: London, England Posts: 17,489 Thanks: 200 Thanked 2,471 Times in 2,449 Posts Hint - if coffeeSize == '8' lattePrice = 1.95 cappuccinoPrice = 1.95 americanoPrice = 1.20 Where are your brackets and braces? BTW, when posting here please help us to help you by following the posting guidelines and wrapping your code in CODE tags. This means use the octothorpe or # button on the toolbar. You can (and should) edit your previous post. Quizmaster: What is the Latin name of the province in Canada which means "New Scotland" in English? Contestant: Johannesburg. __________________ 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.
 05-07-2012, 03:48 PM PM User | #4 Prime8 New Coder   Join Date: Oct 2010 Posts: 51 Thanks: 2 Thanked 0 Times in 0 Posts To reiterate what Philip said, js functions are writen like this: Code: ```function functionName() { code to be executed; }``` You're missing brackets, it's going to give you all sorts of errors without them, and not recognize that it's a function at all. 'IF' statements work the same way. Like this: Code: ```if (x!=1) { code to be executed; }``` Last edited by Prime8; 05-07-2012 at 03:50 PM..
 05-07-2012, 05:14 PM PM User | #5 Philip M Supreme Master coder!     Join Date: Jun 2002 Location: London, England Posts: 17,489 Thanks: 200 Thanked 2,471 Times in 2,449 Posts Prime 8 is entirely correct, but it is recommended that the opening brace { is placed on the same line as the function, if, else, do, while, or for statement and not on the following line. This is because of something known as automatic semi-colon insertion. If you disregard this advice it is looking out and one day it will rise up and bite you in the undercarriage, and create an error which can be hard to find. __________________ 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.

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 03:27 AM.