اقتباسبالنسبة لـ HashMapفهي في النهاية عبارة عن HashTable
لكن المفتاح فيها ليس رقم وإنما كائن
شكرا .. ولكني لم افهم :(
لا أملك معلومة واحدة عن الهاش ماب .. واريد فهمه ..
هل من طريقة ؟
اقتباسبالنسبة لـ HashMapفهي في النهاية عبارة عن HashTable
لكن المفتاح فيها ليس رقم وإنما كائن
شكرا .. ولكني لم افهم :(
لا أملك معلومة واحدة عن الهاش ماب .. واريد فهمه ..
هل من طريقة ؟
أخي Electronic boy ، الأبلت موجود ، ولكن الصفحه ربما مقسمه لفريمات لذلك لن تجدها من القائمه View-Source ،، اذهب وبجانب الأبلت أضغط بالزر الأيمن وأعرض السورس في هذا الموقع ، وستجد موقع الأبلت ..
على العموم بعد تنزيل الملف الأول وتشغيله حصل خطأ وذكر بأنه يوجد كلاس ثاني ، قمت بأخذ أسم الكلاس الموجود في رساله الخطأ ووضعها في المتصفح وحفظ الكلاس ، وقمت بتشغيله مره أخرى ، وحصل خطأ بأن هناك كلاس أخر ... وهكذا استمرت العمليه 9 مرات :) .
في المرفق جميع الكلاسات بالأضافه الى صفحه html وستجد أن الأبلت الأول يعمل ، كرر تلك الخطوات لبقيه الأبلت الذي تريد (الأبلت الثاني أسمه Convolve.class قم بتحميله من نفس المسار ، وترجم البرنامج واذا حصل خطأ سيظهر بأن هناك كلاس غير موجود قم بتحميله وأستمر هكذا حتى يعمل) ،، وحاول أن تجرب decompiler لو أردت النظر للسورس :wink:
بالتوفيق .
http://informatic-ar.com منصة تعليمية عربية في علوم الحاسب والبرمجة
https://moalfat.com للكتب الالكترونية والكورسات التعليمية
Everything we see now is just an engineering solution based on old science
في برنامج الـ Netbeanse
عند اختياري للـ Table لعرضهآ في الـ Frame
فقط يوجد أربعة أعمدهـ ...
السؤال : هل بإمكاني زيادة هذه الأعمدهـ أو إنقاصهآ ؟
أعتذر على الأزعآج .. شكرأ لكم
استطعت حل مشكلة الجداول ..
لم أتعامل مع الأخ نيتبينز من قبل
لهذا لا أعرف كيف يمكن أن تضيف من خلاله
على أي حال انظر هذا الرابط
http://www.roseindia.net/java/example/java...endColumn.shtml
تحياتي
عند مشكله فى كيف انى اخد من داتا بيز واحط فى ليست ممكن حد يساعدنى
بالنسبة للأخ الذي سأل عن موضوع HashMap
هذا المقال كتبته عن مشكلتك
لمحة جافاوية 45: مصفوفة فهارسها ليست أرقام
أتمنى أن يكون مفيداً
أي استفسارات أنا جاهز
أين محاولاتك أخي همسة عتاب1 ؟
تحياتي
كيف يمكن ان احول من array list
الى array
همسة عتاب1 كتب:كيف يمكن ان احول من array listالى array
عن طريق الدالة
إليك مثالا توضيحيا
تم تعديل هذه المشاركة بواسطة djug في 12 ديسمبر 2008 في 15:57
شكرا اخى ولكن لى سوال تانى انا استخدم jlist
واريد عندما اختار منها يفتح ويندو جديده كيف على ان افعل ذلك
ارجو الرد لان محتاجه هذا الشى سريعا
وعليكــم السـلام ورحمة الله وبركاتـه..
حياك الله دكتور Leavetrace ،،
الدوال التي تحتمل أن تأخذ قيما متعدده مختلفه لا يمكن عمل overload لها والسبب ان سنحتاج الى مئات من النسخ لهذه الداله ،، لذلك يمكن أن تستخدم مصفوفه من الحروف char أو متغير string وترسله للداله ، ومن ثم تقوم بفصل القيم داخل الداله ،،
أو الحل الأخر وهو الأفضل والذي تستخدمه الداله println و format وهو باستخدام عدد غير معروف من القيم وهو ما يعرف بVariable-Length Argument Lists ويتم ذلك باستخدام ثلاثه نقاط ellipsis (...) ..
أنظر لهذا المثال وان شاء الله سيتضح المفهوم ،
Variable-Length Argument Lists
ويمكنك البحث في قوقل أكثر عن Varargs للمزيد ،،
بالتوفيق ،،
http://informatic-ar.com منصة تعليمية عربية في علوم الحاسب والبرمجة
https://moalfat.com للكتب الالكترونية والكورسات التعليمية
Everything we see now is just an engineering solution based on old science
للأسف لا يوجد شيء كهذا
كل الموجود هو إعادة تحميل للدالة overloading
اطلعي على الشيفرة المصدرية للجافا
تحياتي
بالنسبه للoverloading للداله println هي لجميع أنواع البيانات :
void println() void println(boolean x) void println(char x) void println(char[] x) void println(double x) void println(float x) void println(int x) void println(long x) void println(Object x) void println(String x)
ولا توجد داله تستقبل أكثر من قيمه ،،، وعندما تستدعي الداله ب :
int x = 10 ;
System.out.println("x = " + x);سوف يقوم المترجم بعمل concatenation للنص ويصبح String ويرسله للداله التي تستقبل الString . أما اذا أرسلت كائن ولم تعرف الداله toString بداخله تقريبا سوف يستدعي الداله التي تستقبل Object ،، أما اذا أرسلت كائن وكنت معرف الداله toString فيه فسوف يقوم بعمل concatenation أيضا ويستدعي الداله التي تستقبل String ،، وهكذا ، يعني بالنهايه دائما هناك قيمه واحده مرسله فقط ..
بالتوفيق .
http://informatic-ar.com منصة تعليمية عربية في علوم الحاسب والبرمجة
https://moalfat.com للكتب الالكترونية والكورسات التعليمية
Everything we see now is just an engineering solution based on old science
مسا الخير
الرجاء .....بدي مساعدة فورية
exception في
Exception in thread "main" java.lang.NullPointerException
at Company.FileToHash(sdsdddd.java:124)
at sdsdddd.main(sdsdddd.java:202)
عم يطلع معي بالكود التالي :
import java.io.*;
import java.math.*;
import java.util.*;
class read
{
int read_integer()
{
InputStreamReader reader=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(reader);
while(true)
try{
String s=br.readLine();
int x=Integer.parseInt(s);
return x;
}
catch(Exception e){
System.out.println("reenter value");
}
}
String read_string()
{
InputStreamReader reader=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(reader);
while(true)
try{
String s=br.readLine();
return s;
}
catch(Exception e){
System.out.println("reenter value");
}
}
}
class employee{
employee(){}
employee(int no,String name,int category){
this.no=no;
this.name=name;
this.category=category;
salary=10000;
years=0;
}
public String toString(){ return ""+no+ " "+name+" "+years+" "+category+" "+salary;}
int no;
String name;
int years;
int category;
double salary;
int sqrt(int num)
{
return num*num;
}
double CalcSalary (){
if (years<1){
return salary =10000;
}
else
return salary = sqrt(years*(1/category)*(1/category)*(1/category))*30000;
}
}
class Company implements Serializable{
Company(){}
int EmployeeNumber=0;
void AddEmployee(ArrayIndex MainArray[],int no,String name,int category){
int i= category % 7+category;
MainArray.EmployeeNum++;
MainArray.list.add(new employee(no,name,category));
}
void DelEmployee(ArrayIndex MainArray[],String name,int category){
int i= category % 7+category;
MainArray.EmployeeNum--;
int j=0;boolean ok=false;
while (j<MainArray.list.size() && ok== false)
{
if (((employee)(MainArray.list.get(j))).name==name){
ok=true;
}
else{
j++;
}
}
MainArray.list.remove(j);
}
void PeopleNum(ArrayIndex MainArray[]){
int sum=0;
int k=0;
for (int i=1;i<4;i++){
k=i % 7+i;
sum=sum+MainArray[k].EmployeeNum;
}
this.EmployeeNumber=sum;
}
void FileToHash(ArrayIndex MainArray[]){
ObjectInputStream input =null;
int k=0;
try{
input =new ObjectInputStream(new FileInputStream("C:\\employee.dat"));
}
catch(IOException lll){}
try {k=(Integer)input.readObject();}
catch (ClassNotFoundException ex1){System.err.println(ex1);}
catch (IOException ex2){System.err.println(ex2);}
for (int i=1;i<=k;i++){
try {
employee emp=(employee)input.readObject();
int empCat=emp.category;
int j=empCat % 7+empCat;
MainArray[j].list.add(emp);
}
catch (ClassNotFoundException ex11){System.err.println(ex11);}
catch (IOException ex22){System.err.println(ex22);}
}
}
void HashToFile(ArrayIndex MainArray[]){
File myfile =new File("C:\\employeee.txt");
PrintWriter p=null;
try{
p=new PrintWriter(new BufferedWriter(new FileWriter(myfile)));
}
catch(IOException ex){System.err.println(ex);}
ObjectOutputStream output =null;
try
{
output =new ObjectOutputStream(new FileOutputStream("C:\\employee.dat"));
}
catch(IOException l){}
try ////// write employee number at beginig of file
{
output.writeObject(new Integer(EmployeeNumber));
}
catch (IOException ex)
{
System.err.println(ex);
}
for (int k=1;k<4;k++){ ////////// writing staff in file
int i=k % 7+k;
int j=0;
while (j<=MainArray.EmployeeNum)
{
try
{
output.writeObject(MainArray.list.get(j));
////// put information in text file
p.println(MainArray.list.get(j));
}
catch (IOException ex)
{
System.err.println(ex);
}
}
}
p.close();
}
}
class ArrayIndex{
int EmployeeNum;
List<employee> list=new ArrayList<employee>();
}
public class sdsdddd implements Serializable {
public static void main(String[] args) {
read obj=new read();
Company MyCompany=new Company();
ArrayIndex MainArray[]=new ArrayIndex[7];
int choise=0;String s="aaa";int i=0;int c=0;
MyCompany.FileToHash(MainArray);
System.out.println("Data has been loaded from file");
System.out.println("Press 1 to add employee");
System.out.println("Press 2 to delete employee");
System.out.println("Press 3 to get Employee Number");
System.out.println("Press 4 to exit & save changes both to binary & text file");
while(choise !=4){
switch(choise){
case 1:
{
i=obj.read_integer();
c=obj.read_integer();
s=obj.read_string();
MyCompany.AddEmployee(MainArray,i,s,c);
}
case 2:
{
c=obj.read_integer();
s=obj.read_string();
MyCompany.DelEmployee(MainArray,s,c);
}
case 3:
{
System.out.println(MyCompany.EmployeeNumber);
}
ملاحظة :
انا عم استخدم
jdk
بعرف اني طولت عليكم بس
عن جد من باب الاضطرار
وشكرا
انا عايزه برنامج netbeans1.6
netbeansولما بدخل على موقع
بيجبلى فيرجن 6.5
وانا عايزه 6.1
ياريت لينك مباشر
هذا رابط لتحميل الإصدار 6.1
http://download.netbeans.org/netbeans/6.1/mysql_bundle/
ملاحظة: تم إيجاد الرابط عن طريق Google
بليز ممكن تساعدوني في الحل
The problem:
Implement a Queue using array, which will read a sequence of positive real numbers. Let user decide on the size for the Queue. User will also enter the element of Queue (any number in random). The output should display sorted values form descending order(largest to smallest).
وهذا الكود بس هوة صح ولا لأ
/*
This program reads up to 100 positive integers from the user and
prints them in sorted order. Input ends when the user enters a
non-positive integer. The numbers are read and stored in an array.
That array is sorted using selection sort, and then the array is
printed.
*/
public class Test {
public static void main(String[] args) {
double[] numbers; // An array for storing the input values.
int numCt; // The number of numbers saved in the array.
double num; // One of the numbers input by the user.
numbers = new double[100]; // Space for 100 numbers.
numCt = 0; // No numbers have been saved yet.
TextIO.putln("Enter up to 100 positive numbers; Enter 0 to end");
while (true) { // Get the numbers and put them in the array.
TextIO.put("? ");
num = TextIO.getlnDouble();
if (num <= 0)
break;
numbers[numCt] = num;
numCt++;
}
selectionSort(numbers, numCt); // Sort the numbers.
TextIO.putln("\nYour numbers in sorted order are:\n");
for (int i = 0; i < numCt; i++) {
TextIO.putln( numbers );
}
} // end main();
static void selectionSort(double[] A, int count) {
// Sort the numbers in A[0], A[1], ..., A[count-1] into
// increasing order using Selection Sort.
for ( int lastPlace = count - 1; lastPlace > 0; lastPlace-- ) {
int maxLoc = 0;
for (int j = 1; j <= lastPlace; j++) {
if (A[j] > A[maxLoc]) {
maxLoc = j;
}
}
double temp = A[maxLoc];
A[maxLoc] = A[lastPlace];
A[lastPlace] = temp;
}
} // end selectionSort
} // end class SortInputNumbersبليز ساعدوني لو سمحتوا
تم تعديل هذه المشاركة بواسطة علاء الصالحي في 23 ديسمبر 2008 في 14:16 — السبب: إسافة وسم code
كل مافي الموضوع مطلوب برنامج عن الاعداد الحقيقية المستخدم يدخل الاعداد وعدد المصفوفات الي يبغى فيها الاعداد مثلا يبغى 4 مصفوفات فيدخل 4 ارقام بعدين تظهر هذة الاعداد مرتبة من الاكبر الى الاصغر
مثلا ادخل المستخدم (4,66,5,10) تظهر الاعداد مرتبة(66,10,4,5)
1- هل هذا الكود هو الكود الصحيح؟ 2- اذا كان الكود صحيح للبرنامج طيب ليش يطلع في كود رقم 8 خطئ؟
ياريت تقدر لو سمحت تساعدني
/*
This program reads up to 100 positive integers from the user and
prints them in sorted order. Input ends when the user enters a
non-positive integer. The numbers are read and inserted into
an array. The array is maintained at all times in sorted order.
*/
public class Test { -1
public static void main(String[] args) { -2
double[] numbers; // An array for storing the input values. -3
int numCt; // The number of numbers saved in the array. -4
double num; // One of the numbers input by the user. -5
numbers = new double[100]; // Space for 100 numbers. -6
numCt = 0; // No numbers have been saved yet. -7
TextIO.putln("Enter up to 100 positive numbers; Enter 0 to end"); -8
while (true) { // Get the numbers and insert them into the array. -9
TextIO.put("? "); -10
num = TextIO.getlnDouble(); -11
if (num <= 0) -12
break; -13
insert(numbers, numCt, num); -14
numCt++; -15
}
TextIO.putln("\nYour numbers in sorted order are:\n"); -16
for (int i = 0; i < numCt; i++) { -17
TextIO.putln( numbers ); -18
}
} // end main();
static void insert(double[] A, int itemsInArray, double newItem) {
// Assume that A contains itemsInArray in increasing order.
// Insert newItem into its correct position in the sorted array.
int loc = itemsInArray - 1;
while (loc >= 0 && A[loc] > newItem) {
// Move the item from A[loc] up one space.
A[loc + 1] = A[loc];
loc = loc - 1;
}
A[loc + 1] = newItem; // Put newItem in the last vacated space.
} // end insert
} // end class SortInputNumbers
طيب ممكن تساعدني وتقولي استبدلها بأيش
اذا سمحت
ظننت أنك أنت من كتب الشيفرة
لهذا فيجب عليك أن تعرف ماذا تعني
بالطبع لا أستطيع أن أساعدك في أن تغش
إذا قررت أن تحل بنفسك حينها يمكنني المساعدة
تحياتي
هذا الموضوع مغلق.