Question
PLease help me with this 8-1 and 8-2 are related ... note: I have done eveything and the Prof looked to my code and told
PLease help me with this 8-1 and 8-2 are related ...
note: I have done eveything and the Prof looked to my code and told me that i need to use a fuctions in my code ... please help ...
I need the program works with the functions inside the code not like what I did im my code but the program should work what i create it ..
this is my code ...
1-html> 2-body> 3-script type="text/javascript">
// Program Name: Number Functions // Purpose: Performs four arithmetic operation on two numbers // Author Name: xxxxxxxx // Date last modified: xxxxxxx
// Variables and constants var num1, num2; // numbers to enter var sum; // addition (num1, num2) var prod; // multiplication (num1, num2) var quotient; // division (num1, num2) var mod; // modulus (num1, num2) var ES = ""; // literal empty string var BR = "
"; // HTML line break
// Welcome the user, prompt for two numbers document.write("Welcome to Performs Four Arithmetic Operation on Two Numbers Program!" + BR); num1 = prompt("Enter the first number:",ES); num1 = parseInt(num1); num2 = prompt("Enter the second number:",ES); num2 = parseInt(num2);
// Call the four models, display the results sum = num1 + num2; document.write(" The sum of the two numbers is: " + sum + BR); prod = num1 * num2; document.write(" The product of the two numbers is: " + prod + BR); quotient = num1 / num2; document.write("The quotient of the two numbers is: " + quotient + BR); mod = num1 % num2 document.write("The modulus of the two numbers is: " + mod + BR);
// Thank the user and end the program document.write("Thank you!");
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started