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

Mr.Ahmad

عضو هيئة تدريس

الصورة الرمزية Mr.Ahmad

 
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , واجبات , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة adss_11 مشاهدة المشاركة
أحمد


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


سؤالي هو في ملف الــ 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

____________

اذا تقدرون تفيدوني الله يعطيكم الف عافيــة .,÷‘إ
حياك الله .
هذه المادة يبدوا أنها cpcs 203 البرمجة بلغة الجافا .
ولكن لا مانع ,, سأحاول حل السؤال بما لدي من معلومات حول هذه اللغة ( الجافا ) .
يؤجل حتى يتم حل الأسئلة البقية المتعلقة بـ cpsc 202 .

 

توقيع Mr.Ahmad  

 

سبحان الله وبحمد ,,, سبحان الله العظيم
الحمد لله كما ينبغي لجلال وجهه وعظيم سلطانه .
اللهم صل على محمد وعلى آل محمد كما صليت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد . اللهم بارك على محمد وعلى آل محمد كما باركت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد.

 

Mr.Ahmad غير متواجد حالياً   رد مع اقتباس