الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

شرح سؤالين في الجافا

مغلق
بدأه mane2008 في 22 ديسمبر 2007 · 5 رد · 823 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

1. Write a program that reads two strings s1 and s2; then calls a method count that counts the number of occurrences of s2 in s1. Main then calls another method that prints the result.

2. Write a program that reads in main the values of two positive integers and two strings; then calls a method that compares the two strings in the part specified by the two integers; the method then calls another method that prints whether the first string portion is smaller than, equal or greater than the second string portion

احتاج الى شرح للسؤالين السابقين مع مثال لوسمحتوا وبسرعة - مع الشكر الجزيل

#2
mane2008 كتب:
1. Write a program that reads two strings s1 and s2; then calls a method count that counts the number of occurrences of s2 in s1. Main then calls another method that prints the result.

2. Write a program that reads in main the values of two positive integers and two strings; then calls a method that compares the two strings in the part specified by the two integers; the method then calls another method that prints whether the first string portion is smaller than, equal or greater than the second string portion

احتاج الى شرح للسؤالين السابقين مع مثال لوسمحتوا وبسرعة - مع الشكر الجزيل

اشوف ما فيه احد رد على سؤالي

#3

ليس المنتدى لحل الواجبات راجع تعليمات المنتدى

اطرح محاولتك واذكر المشاكل لتي قابلتك ونحن هنا لمساعدتك

#4
Abdulsalam كتب:
ليس المنتدى لحل الواجبات راجع تعليمات المنتدى

اطرح محاولتك واذكر المشاكل لتي قابلتك ونحن هنا لمساعدتك

هو ما قال حل السوال قال ابغى احد يشرح السوال وغالبيه مشاكلنا أحنا الطلاب عدم فهم المطلوب من السؤال

خاصه وان اللغه الانقليزيه ضعيفه عند البعض وأنا منهم وشئ ثاني أن الأساتذه يعطونا واجبات احيانا من دون ما نكون اتمرسنا من مبادئها

وكان ممكن ترد رد ألطف وتقوله على شئ يقرأه وممكن يستفيد منه بما أنك خبير في هذا المجال

اسفه لصاحب الموضوع الرئيسي ما أقدر أفيدك لاني مبتدئه وعندي مشاغل كثير بس اذاعرفت راح أرد عليك

#5

بسم الله الرحمن الرحيم

سؤالي هو هل هذين السؤالين مكتوبه باللغه الانجليزية . لانني لم افهمها علماً بانني قد امضيت في امريكا 5 سنوات ادرس علوم الكمبيوتر . الكلمات انجليزية ولكنها ككل غامضة والسبب هو ان الذي كتبها غير ملم بالانجليزية. لو يعاد صياغتها حينها يمكن فهمها

وشكراً

#6

السلام عليكم

بالنسبة للفرع الاول, فهو يطلب منك عمل method تحسب عدد مرات تكرار ال S2 in S1

مثلا لو كان

S2 ="aa"
S1="aaaa"

فإن النتيجة ستكون 2

lastIndexOf
public int lastIndexOf(String str,
					   int fromIndex)
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index. The integer returned is the largest value k such that: 
	 k <= Math.min(fromIndex, str.length()) && this.startsWith(str, k)

If no such value of k exists, then -1 is returned. 

Parameters:
str - the substring to search for.
fromIndex - the index to start the search from. 
Returns:
the index within this string of the last occurrence of the specified substring.

هذه ال method تفيدك

للإطلاع

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#indexOf(java.lang.String, int)://http://java.sun.com/j2se/1.4.2/docs...ng.String, int)://http://java.sun.com/j2se/1.4.2/docs...ng.String, int)

تم تعديل هذه المشاركة بواسطة الحرازي في 27 ديسمبر 2007 في 19:56

هذا الموضوع مغلق.

مواضيع مشابهة