Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Based on the following description, write the complete JavaScript codes.
Once the button “Send Order” is clicked, it will call function get_input().

In function get_input()
• Get the customer name and address from the form.
• Identify which cake the customer selected. Call function get_cakeprice(…) and pass cake to get the price of the cake.
• Identify whether the customer wants the cake to be delivered to the home or not. Call function get_deliveryprice(…) to get the delivery price.
• Identify price of candles.
• Identify message and message price.
• Calculate total bill.
• Call function print_bill(…) and send necessary variables to be printed.

In function get_cakeprice(…)
• Get the cake name from function get_input().
• Use switch case statement to identify the cake price and return the cake price.

In function get_deliveryprice(…)
• Using if..else statement, identify the delivery cost.
• Return the delivery cost.

In function print_bill(…)
• Get all the necessary variables from function get_input() and display as shown

use this form codes:

<body>

<FIELDSET><LEGEND>Customer Order Details</LEGEND>

<form name="orderfrm">

<p>Name : <input type="text" name="custname" size="100"></p>
<p>Address : <textarea name="custaddress" rows="2" cols="50"></textarea></p>

<p>Cake :
<br><input type="radio" name="cake" value="Carrot Cheese Cake" />Carrot Cheese Cake ($ 67.00)
<br><input type="radio" name="cake" value="Black Forest Cheese" />Black Forest Cheese ($ 80.00)
<br><input type="radio" name="cake" value="Hazel Cheese" />Hazel Cheese ($ 60.00)
</p>

<p>Delivery ($ 10.00) :
<select name="delivery">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</p>

<p>Candles ($ 3.00) : <input type="checkbox" name="candles" value="3" />Candles</p>

<p>Message ($ 5.00) : <input type="text" name="cakemsg" size="100"></p>

<p><input type="button" name="sendbtn" value="Send Order" onclick="get_input()"></p>

<br>

</form>

</FIELDSET>

</body>
Posted
Updated 12-Dec-11 12:11pm
v3
Comments
LanFanNinja 12-Dec-11 18:34pm    
I am sure someone here would be more than happy to write this program for you. If you pay them some money that is. :)

1 solution

See this[^]

-- Sourced from JSOP
 
Share this answer
 
Comments
LanFanNinja 12-Dec-11 18:34pm    
+5
Nikil S 12-Dec-11 18:57pm    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900