تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Part 1:
Task #1 Practice how to use functions and if-else-statements with
logical operators (&&, 11, !):
• Write a simple JavaScript program that allows user to enter two numbers in
•
the two textboxes called textN1 and textN2 respectively.
Choose one of the options will perform the associated action.
You are required to create a graphical program as indicated below:
Calculator
(Put your own name here)
N11
°
N21
°
Result
Average
Larger
Reset
Students
Rules:
> Data are entered in the two textboxes.
Create two functions:
A function called Average to compute the average of two numbers and
the result will be displayed in the textbox called textResult.
A function called Larger which will put the larger of the two numbers
in the textbox called textResult.
If the reset option is chosen, all the textboxes will be reset to 0.
Hints:
n1 = Number(textN1.value); //convert from text to numeric value
12 13 14
1112
Task #1: Practice How to Use and Design Functions
Create a simple program as shown in the following diagram:
Length
width:
Areal
Code for your function
textbox
obiect
button
object
Insert your
function codes
here
textarea
object
.
You are required to write a function named findArea that accepts
width and length as parameters. The function should return the
area of this rectangle.
This program should use a button to invoke the findArea function and
display the output in a textbox
Put your function code in the textarea object for the users to view.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.