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 How to calculate the area of a Rectangle

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 08-01-2006, 02:57 PM PM User | #1 Wardy118 New Coder   Join Date: Jul 2006 Posts: 81 Thanks: 4 Thanked 0 Times in 0 Posts How to calculate the area of a Rectangle I have been looking at this for a few days now but cant see where i'm going wrong. Basically i want the program to ask the user to input the length and width of 4 rectangles, calcualte the area of each and then store the information in the array which will then be shown to the user. Here is my code so far which only asks the user for 1 rectangle. test
 08-01-2006, 03:15 PM PM User | #2 vwphillips Senior Coder   Join Date: Mar 2005 Location: Portsmouth UK Posts: 4,431 Thanks: 3 Thanked 481 Times in 468 Posts Code: ```test
``` __________________ Vic God Loves You and will never love you less. http://www.vicsjavascripts.org.uk/ If my post has been useful please donate to http://www.operationsmile.org.uk/
 08-01-2006, 03:26 PM PM User | #3 Wardy118 New Coder   Join Date: Jul 2006 Posts: 81 Thanks: 4 Thanked 0 Times in 0 Posts thanks for such a quick response. that has worked wonders. Cheers once again Vic Wardy
 08-01-2006, 05:15 PM PM User | #4 Wardy118 New Coder   Join Date: Jul 2006 Posts: 81 Thanks: 4 Thanked 0 Times in 0 Posts I want to do a similar program to the rectangle one i mentioned in this thread. Basically i want a program which allows the user to find out the area of 2 shapes being Rectangle and Circle. The User should type 'r' for rectangle and 'c' for circle. The user will be able to input 4 dimensions which will then be stored into an array. I want the output to look something like this: Here are the shapes you entered and their areas 1. Rectangle..............Area 3 Square Centimetres 2. Circle....................Area 12.33 Square Centimetres 3. Rectangle..............Area 34.55 Square Centimetres 4. Circle.....................Area 50.23 Square Centimetres So far my program prompts the user to enter 'r' or 'c' and asks for the legth and width but it shows the ouput on the screen as it happens. what i want to happen is it to be stored and then shown all together at the end of the 4 chosen dimensions and shapes. I also want numbers to be included in the ouput which i can't seem to get on my program so far. Here is my code so far: 4 Dimensions
Any ideas where i'm going wrong? Thanks wardy
 08-01-2006, 06:18 PM PM User | #5 Wardy118 New Coder   Join Date: Jul 2006 Posts: 81 Thanks: 4 Thanked 0 Times in 0 Posts I persume in oder to get the desired output of: Here are the shapes you entered and their areas 1. Rectangle..............Area 3 Square Centimetres 2. Circle....................Area 12.33 Square Centimetres 3. Rectangle..............Area 34.55 Square Centimetres 4. Circle.....................Area 50.23 Square Centimetres I would need to have a line saying something like document.write('Here are the shapes you entered and their areas'), but wherever i put this in the program it just has this as the ouput and doesnt allow the user to enter dimensions. It basically ignores the shapes and dimensions which follow.
 08-01-2006, 06:51 PM PM User | #6 vwphillips Senior Coder   Join Date: Mar 2005 Location: Portsmouth UK Posts: 4,431 Thanks: 3 Thanked 481 Times in 468 Posts document.write may only be used a the page is first rendered Code: ```test
``` __________________ Vic God Loves You and will never love you less. http://www.vicsjavascripts.org.uk/ If my post has been useful please donate to http://www.operationsmile.org.uk/
 08-01-2006, 07:45 PM PM User | #7 Wardy118 New Coder   Join Date: Jul 2006 Posts: 81 Thanks: 4 Thanked 0 Times in 0 Posts Thanks for your help vic

 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 02:50 PM.