Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: can anyone help me solve this code

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default can anyone help me solve this code

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Accident Inquiry Insurance Calculator</title>
    </head>
     
    <script type="text/javascript"> 
     
    	function calculation()
    	{
    	var cover;
    	var policy;
    	var premium;
     
    		if (document.form.budget.checked)
    		cover = 2;
    		else if(document.form.premier.checked)
    		cover = 3;
    		else (document.form.superior.checked)
    		cover = 5;
     
    if (cover ==0)
     
    alert ("level of cover");
    else if (freq==0)
    alert ("frequency of payment");
    else
    alert ((cover*premium)+policy);
    }
     
    </script>
     
     
     
    <body>
    <form id = "form" name = "form">
    <h1>Accident Inquiry Insurance Calculator</h1>
     
    <p>Complete the form below to calculate the cost of your personal accident insurance.</p>
     
    Level of Cover:<br/>
     
    		<br/><input name="cover" input id = "budget" type="radio" value="2" /><label for = "Budget">Budget</label><br/>
     
    		<input name="cover" input id = "premier" type="radio" value="3" /><label for = "Premier">Premier</label><br/>
     
    		<input name="cover" input id = "superior" type="radio" value="5" /><label for = "Superior">Superior</label><br/>
     
    <p>Click here if you want this policy to cover your spouse and children:<input name="policy" type="checkbox" value="$3" /> </p>
     
    Frequency of Premium Payments:<br/>
     
    		<br/><input name="premium" input id = "weekly" type="radio" value="1" /><label for = "Weekly">Weekly</label><br/>
     
    		<input name="premium" input id = "monthly" type="radio" value="4" /><label for = "Monthly">Monthly</label><br/>
     
    		<input name="premium" input id = "yearly" type="radio" value="52" /><label for = "Yearly">Yearly</label><br/>
     
     
        		<br/><input type="button" name="button" id="display" value="Calculate"  onclick="calculation();" />
      			<input type="reset" name="reset" id="reset" value="Reset" />
     
     
    </form>
    </body>
    </html>
    Last edited by helloworld922; September 26th, 2011 at 12:39 AM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: can anyone help me solve this code

    javascript != java. These are java forums, and I presume this refers to javascript. You might try your luck on a javascript specific forum, and should you want help here or elsewhere you should provide a lot more information than 'help me solve this' when reader's don't know what to solve.

Similar Threads

  1. Replies: 4
    Last Post: August 10th, 2011, 11:16 AM
  2. My code have a simple error but i dont know how to solve it !!!
    By Blackhawk1993 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 17th, 2011, 01:12 PM
  3. Solve Them Please
    By omath in forum Java Theory & Questions
    Replies: 1
    Last Post: December 25th, 2010, 04:26 PM
  4. solve it plz
    By tillu in forum Java Theory & Questions
    Replies: 4
    Last Post: December 17th, 2010, 01:45 PM
  5. help me out with the following code to solve the error
    By romilc in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 11th, 2009, 03:45 AM