حلول واجبات الجامعة العربية المفتوحة (لعــspring2017ـــام)

حلول واجبات الجامعة العربية المفتوحة لجميع تخصصات الجامعة ولجميع فروع الجامعة حلول واجبات – مشاريع تخرج – ملخصات هامة Mobile: 00966542495275 حلول واجبات الجامعة ا
 
الرئيسيةاليوميةس .و .جبحـثالأعضاءالمجموعاتالتسجيلدخول

شاطر | 
 

 M150B TMA – Spring 2014/2015 Cut-off date: 25 & 26 April, 2015 M150 Data, computing and information Question 1 [25 marks] Write JavaScript program according to the following: a. Define a JavaScript function countOddNumbers(anArray). The function should ca

اذهب الى الأسفل 
كاتب الموضوعرسالة
whatsapp::00966542495275
Admin


عدد المساهمات : 1462
تاريخ التسجيل : 07/10/2014

مُساهمةموضوع: M150B TMA – Spring 2014/2015 Cut-off date: 25 & 26 April, 2015 M150 Data, computing and information Question 1 [25 marks] Write JavaScript program according to the following: a. Define a JavaScript function countOddNumbers(anArray). The function should ca   الجمعة مارس 13, 2015 5:30 am

M150B
TMA – Spring 2014/2015
Cut-off date: 25 & 26 April, 2015
M150 Data, computing and information
Question 1 [25 marks]
Write JavaScript program according to the following:
a. Define a JavaScript function countOddNumbers(anArray). The function should calculate and return the number of odd numbers in the array anArray.
b. Define another JavaScript function countEvenNumbers(anArray). The function should calculate and return the number of even numbers in the array
anArray.
c. Create an array of five elements.
d. Read numbers from the user and store them in the array. Print the elements in the output window.
e. Use the two functions countOddNumbers and countEvenNumbers to print the number of odd and even numbers in the array you defined.
f. Run your program to make sure it works as specified. Provide three screenshots that show the output of your program in three different cases as follows:
- One when the array containing odd and even numbers.
- One when the array containing only odd numbers.
- One when the array containing only even numbers.

Question 2 [25 marks]
In unit 9, you learnt that it is possible to use a function from its specification, without needing to know how it works. You also learnt how to import a function library into a JavaScript program and how to write simple programs that use a function library.
The course book introduces three functions libraries: "dateLibrary", "drawingLibarary" and "stringLibrary". You can get the complete code and specification of these libraries from the course CD.
Using functions from both: the "drawingLibarary.js" and the "stringLibrary.js", write JavaScript program to do the following:
a. Draw a simple house using a triangle, a rectangle. Then draw three horizontal lines under the house representing the grass.
b. Read a short sentence (not just a word) from the user describing the house. Print the sentence in the output window.
c. Print the sentence reversed in the output window.
d. Read a single character from the user.
e. Check if the character is contained in the sentence you read from the user.
- If yes, then find out how many times the character exists in the sentence and print the value in the output window.
- If no, print an appropriate message accordingly.
f. Print two different shapes of your choice.
g. Run your program to test it. In your Solution document insert two screenshots:
- One showing the case when the character is not contained in the sentence;
- One showing the case when the character is contained in the sentence.
Note: Steps a, c, e and f should be done using functions either from "drawingLibarary.js" or "stringLibrary.js".

Question 3 [25 marks]
You are required to model a new user-defined object type, Course. The Course object type has the following properties:
name: a string representing the name of the course.
code: a string representing the code of the course.
gcc: a string representing the name of the General Course Coordinator of the course
(i.e. the name of the tutor responsible for putting the course exams and TMA).
finalDate: a Date object representing the date of the final exam of the course.
The Course object type has the following methods:
getName(): a method that returns the name of the course.
getCode(): a method that returns the code of the course.
getGCC(): a method that returns the name of the gcc of the course.
setGCC(aName): a method that changes the course gcc to aName.
calculateDaysLeft(): a method that calculates and returns the number of days left for the final exam.
Write JavaScript statements to do the following:
a. Write the Course constructor function function Course (courseName, courseCode, gccName,aDate).
b. Implement the methods getName(), getCode(), getGCC(), setGCC()and
calculateDaysLeft()according to the above specifications.
c. Create a Course object and initialize all its properties by values entered by the user. This should include reading the values for the year, month and day of the final exam date and create a Date object accordingly.
d. Use appropriate methods to do the following for the Course object you've created:
1. Print the name, code and the name of the gcc in the output window.
2. Print the date of the final exam. This should be done using function from the Date library for clear representation of the date, such as dateStringShort() or dateStringLong().
3. Print the numbers of days left for the final exam.
4. Change the name of the gcc to any name of your choice.
e. Without using any method, print the name of the new gcc in the output window.
f. In your Solution document insert two screenshots: [4]
- One showing the program prompting for the Course name, with you having entered the name but not yet pressed OK;
- One showing all the resulted output of the program.


Page 1 / 5
M150B
TMA – Spring 2014/2015
Cut-off date: 25 & 26 April, 2015
Total marks: 80
Arab Open University
Faculty of Computer Studies
M150 Data, computing and information
Page 2 / 5
Question 1 [25 marks]
Write JavaScript program according to the following:
a. Define a JavaScript function countOddNumbers(anArray). The function
should calculate and return the number of odd numbers in the array anArray.
b. Define another JavaScript function countEvenNumbers(anArray). The
function should calculate and return the number of even numbers in the array
anArray.
c. Create an array of five elements.
d. Read numbers from the user and store them in the array. Print the elements in
the output window.
e. Use the two functions countOddNumbers and countEvenNumbers to
print the number of odd and even numbers in the array you defined.
f. Run your program to make sure it works as specified. Provide three screenshots
that show the output of your program in three different cases as follows:
- One when the array containing odd and even numbers.
- One when the array containing only odd numbers.
- One when the array containing only even numbers.
Page 3 / 5
Question 2 [25 marks]
In unit 9, you learnt that it is possible to use a function from its specification, without
needing to know how it works. You also learnt how to import a function library into a
JavaScript program and how to write simple programs that use a function library.
The course book introduces three functions libraries: "dateLibrary", "drawingLibarary"
and "stringLibrary". You can get the complete code and specification of these libraries
from the course CD.
Using functions from both: the "drawingLibarary.js" and the "stringLibrary.js", write
JavaScript program to do the following:
a. Draw a simple house using a triangle, a rectangle. Then draw three horizontal lines
under the house representing the grass.
b. Read a short sentence (not just a word) from the user describing the house. Print the
sentence in the output window.
c. Print the sentence reversed in the output window.
d. Read a single character from the user.
e. Check if the character is contained in the sentence you read from the user.
- If yes, then find out how many times the character exists in the sentence and
print the value in the output window.
- If no, print an appropriate message accordingly.
f. Print two different shapes of your choice.
g. Run your program to test it. In your Solution document insert two screenshots:
- One showing the case when the character is not contained in the sentence;
- One showing the case when the character is contained in the sentence.
Note: Steps a, c, e and f should be done using functions either from "drawingLibarary.js"
or "stringLibrary.js".
Page 4 / 5
Question 3 [25 marks]
You are required to model a new user-defined object type, Course. The Course
object type has the following properties:
name: a string representing the name of the course.
code: a string representing the code of the course.
gcc: a string representing the name of the General Course Coordinator of the course
(i.e. the name of the tutor responsible for putting the course exams and TMA).
finalDate: a Date object representing the date of the final exam of the course.
The Course object type has the following methods:
getName(): a method that returns the name of the course.
getCode(): a method that returns the code of the course.
getGCC(): a method that returns the name of the gcc of the course.
setGCC(aName): a method that changes the course gcc to aName.
calculateDaysLeft(): a method that calculates and returns the number of days
left for the final exam.
Write JavaScript statements to do the following:
a. Write the Course constructor function function Course (courseName,
courseCode, gccName,aDate).
b. Implement the methods getName(), getCode(), getGCC(), setGCC()and
calculateDaysLeft()according to the above specifications.
c. Create a Course object and initialize all its properties by values entered by the
user. This should include reading the values for the year, month and day of the final
exam date and create a Date object accordingly.
d. Use appropriate methods to do the following for the Course object you've created:
1. Print the name, code and the name of the gcc in the output window.
2. Print the date of the final exam. This should be done using function from
the Date library for clear representation of the date, such as
dateStringShort() or dateStringLong().
3. Print the numbers of days left for the final exam.
4. Change the name of the gcc to any name of your choice.
e. Without using any method, print the name of the new gcc in the output window.
f. In your Solution document insert two screenshots: [4]
- One showing the program prompting for the Course name, with you
having entered the name but not yet pressed OK;
- One showing all the resulted output of the program.
Page 5 / 5

_________________
لتحميل ملف حل الواجب الحل النموذجي للواجب.doc يجب عليك  التسجيـــل بالمنتدى لتتمكن من تحميل الملف


حل واجب - خدمات مجانية – حلول واجبات الجامعة الجامعة العربية المفتوحة- كل الجامعات - حل واجب - حل واجب TMA- حل واجب TMA01
لجميع تخصصات الجامعة ولجميع فروع الجامعة
حلول واجبات – مشاريع تخرج – ملخصات هامة
Mobile: 00966542495275  or
WhatsApp:00966542495275

smsm.hamdy66@yahoo.com
حلول مضمونة وغير مكررة وغير متشابهة لجميع واجبات الجامعة
متوفرمدرسين ومدرسات لجميع المواد والتخصصات
السعودية-الكويت-لبنان-مصر-البحرين-الأردن-عمان-الرياض-الدمام-جدة-حائل-الاحساء-المدينة المنورة
KSA-Kuwait-Bahrain-Oman-Jordon-Lebanon-Egypt
قسم خاص لواجبات التربية لجميع التخصصات ولجميع المستويات
http://tmas.123.st
الرجوع الى أعلى الصفحة اذهب الى الأسفل
معاينة صفحة البيانات الشخصي للعضو http://learn.123.st
 
M150B TMA – Spring 2014/2015 Cut-off date: 25 & 26 April, 2015 M150 Data, computing and information Question 1 [25 marks] Write JavaScript program according to the following: a. Define a JavaScript function countOddNumbers(anArray). The function should ca
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1
 مواضيع مماثلة
-
» Avira Premium Security Suite 9.0.0.387 + key 2014
» نكت 2015 لحق حالك
» 2015 عام انقراض القنوات الارضية
» تشكيل لجنة لإعداد ملف لاستضافة المغرب لأمم إفريقيا عام 2015 أو 2017
» شفرات ميدل اوف اونر

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
حلول واجبات الجامعة العربية المفتوحة (لعــspring2017ـــام) :: حل واجب الجامعة العربية المفتوحة 2018 الفصـــ 1 ــل :: حل واجبات دبلوم التربية-
انتقل الى: