منتديات طلاب الجامعة العربية المفتوحة aoua.com

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

شاطر | 
 

 حل واجب m105 النسخة النموذجية

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


عدد المساهمات : 776
تاريخ التسجيل : 10/10/2012

مُساهمةموضوع: حل واجب m105 النسخة النموذجية   الإثنين مارس 25, 2013 10:56 am

Question One: [5 marks]
Programming languages may be divided into three general types.
a. List them. [3 marks]
b. State which of these types require a translator program such that a computer can understand, and name this program in each case. [2 marks]
Question Two: [10 marks]
a. Write a Java class (program) that reads from the user the radius of a cylinder and its height as real numbers. Then calculates and prints the surface area and the volume of the cylinder (both rounded to 2 decimal places). See the given figure. [8 marks] Hint: Use Math.PI for the value of π.
b. Give the exact output of your program. Provide 2 snapshots representing the exact output of 2 different input values. [2 marks]
Question Three: [20 marks]
a. Write a Java program (using a nested if-else statement) equivalent to the following UML activity diagram. [10 marks]
b. Give the exact output of your program in part a. Provide 2 snapshots representing the exact output of 2 different digits (such that one of them is between 1 and 5 and the other value is greater than 5). [2 marks]
c. Rewrite your program using a switch statement. [8 marks]
4
Question Four: [5 marks]
Trace the following program and give its exact output. Provide 2 snapshots representing the exact output of 2 different numbers (such that one of them is 0).
import java.util.Scanner;
public class Q4 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a positive integer less than 20: ");
int number = input.nextInt();
do {
System.out.printf("%-10d", number);
if ( (number % 2 == 0) || (number % 5 == 0) ) {
System.out.println("YES");
continue;
}
System.out.println("NO");
} while (number-- > 0);
System.out.println("Done");
} // end main method
} // end class Q4
5
Question Five: [20 marks]
a. Write a Java application that reads from the user a positive integer less than 2147483648. Then separates the integer into its individual digits and prints a message indicating if the sum of its digits is odd or even. [17 marks] Example: If the user enters 35271, the message should be: The sum of the digits of 35271 is even. Explanation: 3 + 5 + 2 + 7 + 1 = 18 which is even. Hint: refer to the file M105-Lab_02, Lab exercise 3, pages 27-29.
b. Give the exact output of your application. Provide 3 snapshots representing the exact output of 3 different values (such that the sum of digits is odd, the sum of digits is even and the value itself ≥ 2147483648). [3 marks]
Question Six: [20 marks]
a. Write a Java method called formula that takes 2 positive integers x and y as arguments and return as an integer the result of the following mathematical function:
( ) ⌈√ ⌉ [10 marks] Hints: Use the static methods of the class Math. |x| = the absolute value of x ⌈ ⌉ = the ceiling (ceil) value of x
b. Include your method into a Java application that reads a sequence of inputs. Each input consists of 2 integers. The application invokes (calls) the method formula and prints the result for each input. The user could stop the program when the values -1 and -1 are entered as input. [9 marks] Sample Input and Output: (the result should be displayed instead of …) Enter x and y (Enter -1 -1 to stop): 3 5 f(3,5) = … Enter x and y (Enter -1 -1 to stop): 6 2 f(6,2) = … Enter x and y (Enter -1 -1 to stop): 4 4 f(4,4) = … Enter x and y (Enter -1 -1 to stop): -1 -1
c. Give the exact output of your application. Provide a snapshot representing the exact output of a sequence of at least 3 inputs before the user enters the values -1 and -1. [1 mark]
6
Question Seven: [20 marks]
a. Write a Java application that does the following:
 Reads an integer from the user represents the number of the students in a class.
 Reads the scores of the students from the user and store them in an array.
 Calculates and prints the percentage of the excellent students in the class rounded to 1 decimal place.
[18 marks] Hints: The scores of the students are integers between 0 and 100 (inclusive). The student considered to be Excellent if his/her score is greater than or equal to 90. Sample Input: Enter the number of the students in the class: 5 Enter the score of student no. 1: 70 Enter the score of student no. 2: 95 Enter the score of student no. 3: 60 Enter the score of student no. 4: 89 Enter the score of student no. 5: 90 Sample Output: The percentage of the excellent students in the class is: 40.0%.
b. Give the exact output of your application. Provide 2 snapshots representing the exact output of 2 different inputs. [2 marks]

_________________
لتحميل ملف حل الواجب "TMA Answer(1).doc" يجب عليك  التسجيـــل بالمنتدى لتتمكن من تحميل الملف




حل واجب - خدمات مجانية – حلول واجبات الجامعة الجامعة العربية المفتوحة- كل الجامعات - حل واجب - حل واجب TMA- حل واجب TMA01
لجميع تخصصات الجامعة ولجميع فروع الجامعة
حلول واجبات – مشاريع تخرج – ملخصات هامة
http://aouq.123.st/
[color=green]
WhatsApp: 00966542495275

smsm.hamdy66@yahoo.com
حلول مضمونة وغير مكررة وغير متشابهة لجميع واجبات الجامعة
متوفرمدرسين ومدرسات لجميع المواد والتخصصات
السعودية-الكويت-لبنان-مصر-البحرين-الأردن-عمان-الرياض-الدمام-جدة-حائل-الاحساء-المدينة المنورة
KSA-Kuwait-Bahrain-Oman-Jordon-Lebanon-Egypt
قسم خاص لواجبات التربية لجميع التخصصات ولجميع المستويات
http://aouq.123.st/
الرجوع الى أعلى الصفحة اذهب الى الأسفل
معاينة صفحة البيانات الشخصي للعضو http://aouq.123.st
 
حل واجب m105 النسخة النموذجية
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتديات طلاب الجامعة العربية المفتوحة aoua.com :: حلول واجبات الجامعه العربيه المفتوحه 2016/2017 :: حلول واجبات الجامعة العربية المفتوحة 2012-2013 :: حلول واجبات الجامعة العربية المفتوحة AOU-
انتقل الى: