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

[مخالف - طلب حل : ]اريد تصحيح بسيط في كود+حل لسؤال

مغلق
بدأه black star في 17 نوفمبر 2010 · 2 رد · 494 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي سؤالين واحد سوتلة كود بس فية مشكلة في والثاني ماعرفته

الرجاء لمن يعرف احد حل هذه الأسئله المساعده

Question 1

Write a program that reads integers, finds the largest of them, and counts its occurrences. Assume that the input ends with number 0. Suppose that you entered 3 5 2 5 5 5 0; the program finds that the largest is 5 and the occurrence count for 5 is 4. Here are sample runs of the program:

Sample 1:

Enter numbers: 3 5 2 5 5 5 0

The largest number is 5

The occurrence count of the largest number is 4

الكود في الملحقات

اولا: المشكلة عندي لما يدخل المستخدم الأرقام في سطر واحد مثل

Enter numbers: 3 6 5 4 2 4 5 4 5 5 0

اعتقد البرنامج يحسب السطر كلة على انة رقم واحد .. كيف اخلى البرنامج يفصل كل رقم على حده في سطر واحد؟؟؟

ثانيا: في الجملة

, assign the first number to max

في الكود عندي كل مره إدخل المستخدم رقم جديد استبدله على انو (ماكس) كيف اخلى البرنامج يخزن فقط اول رقم من المستخدم على انه (ماكس) وتتم مقارنتة مع الأرقام الباقية الا ادخلها ؟؟؟

Question 2:

Write a JAVA program that compares the performance of two type-writers according to the number of words he/she types in one minute.

Create a class named TypeWriter.

Following should be the data members

• Name //for the name of type writer

• Words //for the number of words he/she types in one minute

Initialize them with default value. But later on take input from user for name and number of words and assign it to TypeWriter1 & TypeWriter2

Member function should be

• Compare

To compare the number of words he/she types in one minute

You are required to display a message stating; which type writer is a better performer. Also display a statement that tells how many words a better performer types more than that of worse performer. Write getter/setter and for the class TypeWriter.

Your output should be similar to the following

Sample 1:

Please enter the information about Typewriter 1

name Mark

number of words typed in one minutes 60

Please enter the information about Typewriter 2

name Henry

number of words typed in one minutes 40

Performance of Mark is better than Henry

Mark types 20 more words than Henry

Sample 2:

Please enter the information about Typewriter 1

name Angela

number of words typed in one minutes 60

Please enter the information about Typewriter 2

name Julie

number of words typed in one minutes 60

Performance of Angela is same as of Julie

هذا ما عرغت حله؟؟

q1.java

−1
#2

هذا تعديل الكوود الذى وضعتيه

import java.util.Scanner;

public class q1 {

	public static void main(String args[]) {
    	int max;
    	int count = 1;
    	int a = 0;
    	Scanner input = new Scanner(System.in);
    	max = a;
    	do {
        	System.out.print("Enter numbers: ");
        	a = input.nextInt();
        	if (a > max) {
            	max = a;
        	} else if (a == max) {
            	count++;
        	}
    	} while (a != 0);
    	System.out.printf("The largest number is %d", max);
    	System.out.printf("%nThe occurrence count of the largest number is %d%n", count);
	}
}

يرجى المحاوله فى الاسئله الباقيه

حيث لا يتم اغلاق الموضوع تحت بند حل الواجبات

بالتوفيق

لم انظر للمطلوب صراحه

لكن عندما وجدت حل اسئله واجبات وهكذا

تعاملت مع الكود المرفق فقط

Software Developer
Mahmoudkelany.com


 

#3

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته.

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات، فقرة طلب حل الواجبات والتمارين.

قواعد طرح المشاركات

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

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

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…