عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 19-10-2009, 04:30 PM   #15

أحـمـد ظـافـر

مشرف مُتألق سابق

الصورة الرمزية أحـمـد ظـافـر

 
تاريخ التسجيل: Oct 2008
كلية: كلية الهندسة
التخصص: مدنيّة
نوع الدراسة: إنتظام
المستوى: الرابع
البلد: الدول العربية
الجنس: ذكر
المشاركات: 2,472
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , واجبات , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

أحمد


الله يجزاك الجنة ؟.,


سؤالي هو في ملف الــ handout-01 اللي اعطانا هوه الدكترو <<< واااجب صــ15 و 16

Lab 1.1: Your First Java Program
In this lab, you will write a Java program that uses the System.
out.prinlnt() method to display an email signature (name, title, email
address, and so forth).
Perform the following steps:
1. Create a new subdirectory in your javafiles directory, called Lab1_1.
2. Using your editor, start with a public class called Signature.
Add the main() method within the Signature class.
3. Within main(), use the System.out.println() method to print your
name at the command prompt.
4. Similarly, print your title on a line, then your email address, Web
site URL, or phone numbers. (Display any information you want in
your signature. Just remember to use a semicolon after each
println() statement.)
5. Save your Signature source code in the Lab1_1 folder in a file called
Signature.java.
6. Compile Signature.java using the javac tool.
7. Run the Signature program using the java tool.
You should see an output similar to that in Figure 1.10.



--------------------

Lab 1.2: Using Command-Line Arguments
When you run a Java program from the command prompt, you can input
arguments that get passed to the main() method as strings. For example,
suppose that you entered the following command to run your Signature
program from Lab 1.1:
java Signature hello 27 “Rich Raposa”
This command has three command-line arguments beyond the java
Signature command: hello, 27, and Rich Raposa. (Arguments are separated
by spaces unless placed in double quotes.) These three arguments
are passed into main() and placed in the args parameter. The args parameter
is an array of strings that can hold as many command-line arguments
as you enter.
To access these arguments within main(), you use args with a sub
in square brackets. For example, args[0] is the first argument, args[1] is
the second, and so on. In the current example, args[0] will be the string
“hello,” args[1] will be “27,” and args[2] will be “Rich Raposa.”
In this lab, you will display the title and author of a book, where the
title and author are entered as command-line arguments such as:
Title: Green Eggs and Ham
Author: Dr. Seuss
Now, follow these steps:
1. Create a new subdirectory of javafiles, called Lab1_2.
2. Open your editor, and write a public class called Book.
3. Add main() within your Book class.
4. The title will be args[0] and the author will be args[1]. You need to
concatenate “Title: “ with args[0], which is done by using the + operator.
For example:
System.out.println(“Title: “ + args[0]);
5. Similarly, use the concatenation operator to display “Author: “ and
args[1].
6. Save your Book class in the Lab1_2 directory in a file called
Book.java.
16 Chapter 1
7. Compile the Book class.
8. Run the Book program, using two command-line arguments:
java Book “Green Eggs and Ham” “Dr. Seuss”
If

____________

اذا تقدرون تفيدوني الله يعطيكم الف عافيــة .,÷‘إ

 

 

لا تنس #أذكار_الصباح
لا تنس #أذكار_المساء
استغفر الله العظيم الذي لا إله إلا هو الحي القيوم وأتوب إليه.
اللهم صل على محمد وعلى آله وأصحابه والتابعين.
اللهُمَّ إرحم موتَانآ وموتـــــَى المُسلِمينْ والمُسلِمآتْ
اللهُمَّ قِهمْ عذَابَ القـــَبْر وفِتنَته.

اللهُمَّ إٍنَّا نسألُكَ حُسنَ الخَاتِمة .

 

أحـمـد ظـافـر غير متواجد حالياً   رد مع اقتباس