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 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
Get step-by-step solutions from verified subject matter experts
