إعـــــــلان

تقليص
لا يوجد إعلان حتى الآن.

حل واجب m105 المهندس 0544321455 الجامعة العربية المفتوحة [email protected]

تقليص
X
 
  • تصفية - فلترة
  • الوقت
  • عرض
إلغاء تحديد الكل
مشاركات جديدة

  • [معروض] حل واجب m105 المهندس 0544321455 الجامعة العربية المفتوحة [email protected]

    حل واجبات الجامعة العربية المفتوحة
    اتصل : O544321455 - OO966544321455
    واتس اب: 966544321455+
    ايميل : a_al_shora@hot mail.com
    سكايبي : a_al_shora


    حل واجب 0.5.4.4.3.2.1.4.5.5 الجامعة العربية المفتوحة




    حل واجبات الجامعة العربية المفتوحة O54.4.3.2.1.4.5.5 - OO96654.4.3.2.1.4.5.5
    ايميل : a_al_shora @ h.o.t.m.ail.c.o.m
    سكايبي: a_al_shora
    واتس اب: OO96654.4.3.2.1.4.5.5





    Faculty of Computer Studies
    Information Technology and Computing Program
    M105 Tutor-Marked Assignment
    When writing your programs, you should follow good programming style that helps readability. This includes:
    • Using short comment at the beginning stating the purpose of each program.
    • Selecting meaningful names for identifiers.
    • Using spacing and indentations to help make the structure of your program clear.
    Question One: [10 marks]
    a. Write a Java class (program) that reads from user a duration in hours, minutes and seconds. Then calculates and prints an equivalent duration in seconds. [9 marks]
    b. Give the exact output of your program. Provide a snapshot representing the exact output of any value from your choice. [1 mark]
    Example: If user inserts 2 hours, 10 minutes and 30 seconds, the output should be 7830 seconds.
    Hint: You could assume that user will insert non-negative integers.
    Question Two: [20 marks]
    a. Academic status of AOU students could be: - "regular" if their GPA ≥ 2 - "warned" if their GPA < 2 and number of warnings they received < 4 - "dismissed" if their GPA < 2 and number of warnings they received = 4 Write a Java application that reads from user the GPA of a student as a real number and number of warnings he/she received. Then prints the academic status of the student. [17 marks]
    b. Give the exact output of your application. Give 3 snapshots representing the exact output of 3 different cases (i.e., when the student is regular, warned and dismissed). [3 marks]
    Hints:
     If the GPA of the student ≥ 2, do not request from user to enter number of warnings.
     You could assume that user will insert valid data.
    Question Three: [25 marks]
    a. A fruits shop sells several types of fruits each day. Write a program that reads from user several lines of input. Each line includes a fruit's name, price per kilogram (as an integer), number of kilograms sold (as an integer). The program should calculate and print the earned money of all fruits sold and fruit that achieved the largest profit. [23 marks]
    4
    b. Give the exact output of your application. Provide 2 snapshots representing the exact output of 2 different inputs. [2 marks]
    Hint:
     You could assume that user will insert valid data
     User could stop the program via entering the word "stop" as a fruits' name.
    Sample Input and Output: In each line, insert a fruit's name, price per kilogram, number of kilograms sold To halt the program, insert "stop" as a fruit's name ----------- banana 2 11 mango 3 8 peach 4 5 stop ----------- The earned money of all fruits sold: 66 Fruit that achieved the largest profit: mango
    Question Four: [5 marks]
    Provide a snapshot representing the exact output of the following piece of code:
    int x = 9, y = 4, z;
    switch (x + 1 % y) {
    case 1: System.out.println("1: " + x + y);
    case 2: System.out.println("2: " + x + y);
    case 10: System.out.println("10: " + x + y);
    default: System.out.printf("def: %d\n", x + y);
    }
    z = 2;
    do {
    System.out.printf("%-10s", "Now,");
    if (++z == 4)
    continue;
    System.out.printf("z = %d\n" , z);
    } while (z < 6);
    char c = (z == 6) ? 'Y' : 'N';
    System.out.printf("c = %c\n", c);
    String text = "TEXT";
    if ( ! text.equals("text") && (x == 9.0) )
    System.out.println(text);
    if (y > x);
    System.out.printf("%.0f\nOK\n", 99.7);
    5
    Question Five: [27 marks]
    a. Write a Java application that does the following: [26 marks]
     Reads a positive integer from user represents number of the employees in a company.
     Reads salaries of the employees from user (user should enter the salaries, which are real numbers, in one line separated by spaces).
     Calculates and prints the following statistical measures:
     The mean of salaries of the employees (rounded to 2 decimal places).
     The standard deviation of salaries of the employees (rounded to 2 decimal places).
    b. Give the exact output of your application. Provide a snapshot representing the exact output of any values from your choice. [1 mark]
    Hints:
     There is at least one employee in the company.
     You could assume that user will insert valid data.
     Read about "the mean" and "the standard deviation" in any "statistics" book, or search the internet in order to know how to calculate them.
    Sample Input: Enter number of the employees in the company: 5 Enter their salaries: 900 851.75 915.25 700 800.5
    Sample Output: The mean of salaries of the employees is: 833.50 The standard deviation of salaries of the employees is: 77.91
    6
    Question Six: [30 marks]
    a. Write a Java method called isPrime that checks if a given integer is prime or not. The method takes an integer as an argument. Then it returns true if it is prime, false otherwise. [13 marks]
    b. Include your method into a Java program that reads from user number of integers he/she wants to test their primality. Then the program reads a sequence of integers and for each one it invokes (calls) the method isPrime and prints if it is prime or not. At the end, the program displays number of prime numbers inserted. [16 marks]
    c. Give the exact output of your program. Provide a snapshot representing the exact output of a sequence of at least 5 integers. [1 mark]
    Hint:
     Read about "prime numbers" in any "number theory" book, or search the internet in order to know how to test primality of any number. (You could use % operator)
    Sample Input and Output: How many integers do you want to test their primality? 5 Please, insert them: 11 --> is prime 9 --> is not prime -3 --> is not prime 2 --> is prime 1 --> is not prime -----------
    2 prime numbers have been inserted
    Faculty of Computer Studies
    Information Technology and Computing Program
    M105 Tutor-Marked Assignment
    Course Code: M105 Semester: Fall 2013-2014
    Course Title: Introduction to Programming with Java Credit Hours: 3 Hours
    Cut-Off Date: Sunday, December 8, 2013 Total Marks: 120
    Contents
    This TMA covers chapters 1, 2, 4, 5, 6 and 7 of the text book.
    2
    Instructions for submitting TMA
    1. Create a new project in NetBeans. Name it: StudentName_StudentID (e.g. AhmadOmar_099999)
    2. Create all the required classes in TMA inside this project. Name each class according to the question No. in addition to your ID (e.g. Q2_StudentID, Q3_A_StudentID)
    3. You will find a solution template (document file) on LMS with the following name: M105-TMA-2013-2014-Fall-Branch-StudentID-FirstNameLastName
    You should write your answers inside this document, but you need to:
    a) Sign the “Declaration of No Plagiarism” electronically (it is enough to put your name and ID).
    b) Modify the following information in the file name: Branch, StudentID and FirstNameLastName Example: "Ali Hashem" is in Kuwait Branch and his ID is 091234. He should change the file name to be: M105-TMA-2013-2014-Fall-KWT-091234-AliHashem
    4. Copy and paste the code of all the classes + the required snapshots inside the above document file.
    5. Create a compressed file including the folder of your project.
    6. Name the compressed file as the document file.
    7. Submit two separated files: the compressed file + the document file (without compression).
    3
    Important Note: [3 marks]
    When writing your programs, you should follow good programming style that helps readability. This includes:
    • Using short comment at the beginning stating the purpose of each program.
    • Selecting meaningful names for identifiers.
    • Using spacing and indentations to help make the structure of your program clear.
    Question One: [10 marks]
    a. Write a Java class (program) that reads from user a duration in hours, minutes and seconds. Then calculates and prints an equivalent duration in seconds. [9 marks]
    b. Give the exact output of your program. Provide a snapshot representing the exact output of any value from your choice. [1 mark]
    Example: If user inserts 2 hours, 10 minutes and 30 seconds, the output should be 7830 seconds.
    Hint: You could assume that user will insert non-negative integers.
    Question Two: [20 marks]
    a. Academic status of AOU students could be: - "regular" if their GPA ≥ 2 - "warned" if their GPA < 2 and number of warnings they received < 4 - "dismissed" if their GPA < 2 and number of warnings they received = 4 Write a Java application that reads from user the GPA of a student as a real number and number of warnings he/she received. Then prints the academic status of the student. [17 marks]
    b. Give the exact output of your application. Give 3 snapshots representing the exact output of 3 different cases (i.e., when the student is regular, warned and dismissed). [3 marks]
    Hints:
    • If the GPA of the student ≥ 2, do not request from user to enter number of warnings.
    • You could assume that user will insert valid data.
    Question Three: [25 marks]
    a. A fruits shop sells several types of fruits each day. Write a program that reads from user several lines of input. Each line includes a fruit's name, price per kilogram (as an integer), number of kilograms sold (as an integer). The program should calculate and print the earned money of all fruits sold and fruit that achieved the largest profit. [23 marks]
    4
    b. Give the exact output of your application. Provide 2 snapshots representing the exact output of 2 different inputs. [2 marks]
    Hint:
    • You could assume that user will insert valid data
    • User could stop the program via entering the word "stop" as a fruits' name.
    Sample Input and Output: In each line, insert a fruit's name, price per kilogram, number of kilograms sold To halt the program, insert "stop" as a fruit's name ----------- banana 2 11 mango 3 8 peach 4 5 stop ----------- The earned money of all fruits sold: 66 Fruit that achieved the largest profit: mango
    Question Four: [5 marks]
    Provide a snapshot representing the exact output of the following piece of code:
    int x = 9, y = 4, z;
    switch (x + 1 % y) {
    case 1: System.out.println("1: " + x + y);
    case 2: System.out.println("2: " + x + y);
    case 10: System.out.println("10: " + x + y);
    default: System.out.printf("def: %d\n", x + y);
    }
    z = 2;
    do {
    System.out.printf("%-10s", "Now,");
    if (++z == 4)
    continue;
    System.out.printf("z = %d\n" , z);
    } while (z < 6);
    char c = (z == 6) ? 'Y' : 'N';
    System.out.printf("c = %c\n", c);
    String text = "TEXT";
    if ( ! text.equals("text") && (x == 9.0) )
    System.out.println(text);
    if (y > x);
    System.out.printf("%.0f\nOK\n", 99.7);
    5
    Question Five: [27 marks]
    a. Write a Java application that does the following: [26 marks]
    • Reads a positive integer from user represents number of the employees in a company.
    • Reads salaries of the employees from user (user should enter the salaries, which are real numbers, in one line separated by spaces).
    • Calculates and prints the following statistical measures:
     The mean of salaries of the employees (rounded to 2 decimal places).
     The standard deviation of salaries of the employees (rounded to 2 decimal places).
    b. Give the exact output of your application. Provide a snapshot representing the exact output of any values from your choice. [1 mark]
    Hints:
    • There is at least one employee in the company.
    • You could assume that user will insert valid data.
    • Read about "the mean" and "the standard deviation" in any "statistics" book, or search the internet in order to know how to calculate them.
    Sample Input: Enter number of the employees in the company: 5 Enter their salaries: 900 851.75 915.25 700 800.5
    Sample Output: The mean of salaries of the employees is: 833.50 The standard deviation of salaries of the employees is: 77.91
    6
    Question Six: [30 marks]
    a. Write a Java method called isPrime that checks if a given integer is prime or not. The method takes an integer as an argument. Then it returns true if it is prime, false otherwise. [13 marks]
    b. Include your method into a Java program that reads from user number of integers he/she wants to test their primality. Then the program reads a sequence of integers and for each one it invokes (calls) the method isPrime and prints if it is prime or not. At the end, the program displays number of prime numbers inserted. [16 marks]
    c. Give the exact output of your program. Provide a snapshot representing the exact output of a sequence of at least 5 integers. [1 mark]
    Hint:
    • Read about "prime numbers" in any "number theory" book, or search the internet in order to know how to test primality of any number. (You could use % operator)
    Sample Input and Output: How many integers do you want to test their primality? 5 Please, insert them: 11 --> is prime 9 --> is not prime -3 --> is not prime 2 --> is prime 1 --> is not prime -----------
    2 prime numbers have been inserted
    حل واجبات الجامعة العربية المفتوحة
    اتصل : O544321455 - OO966544321455
    واتس اب: 966544321455+
    ايميل : a_al_shora@hot mail.com
    سكايبي : a_al_shora


    حل واجب 0.5.4.4.3.2.1.4.5.5 الجامعة العربية المفتوحة




    حل واجبات الجامعة العربية المفتوحة O54.4.3.2.1.4.5.5 - OO96654.4.3.2.1.4.5.5
    ايميل : a_al_shora @ h.o.t.m.ail.c.o.m
    سكايبي: a_al_shora
    واتس اب: OO96654.4.3.2.1.4.5.5


يعمل...
X