السلام عليكم
عندي سؤالين واحد سوتلة كود بس فية مشكلة في والثاني ماعرفته
الرجاء لمن يعرف احد حل هذه الأسئله المساعده
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
هذا ما عرغت حله؟؟
