Question: Write a javascript program in an HTML page that takes three inputs: 1) your budget, 2) the price of your favorite music band, and 3)

 Write a javascript program in an HTML page that takes three

Write a javascript program in an HTML page that takes three inputs: 1) your budget, 2) the price of your favorite music band, and 3) the price of your favorite cake, and shows one of these two possible messages: 1) you can have both, or 2) you can not have both. Basically, your program will decide based on your budget, whether or not you can have both your favorite music band and your favorite cake. Here are some examples: Example 1. If your budget is $500, the price of your favorite music band is $300, and the price of your favorite cake is $120, the program should show the message "you can buy this item" because to have both, you need $420 which is within your budget. Example 2. If your budget is $500, the price of your favorite music band is $400, and the price of your favorite cake is $120, the program should show the message "you can not buy this item" because to have both, you need $520 which is over your budget. Example 3. If your budget is $500, the price of your favorite music band is $300, and the price of your favorite cake is $200, the program should show the message "you can buy this item" because to have both, you need $500 which is within your budget

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!