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

ارجو المساعده

مغلق
بدأه دلوعة الجافا في 27 فبراير 2006 · 1 رد · 449 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Use DataInputStream and DataOutputStream classes, to read from the keyboard a set of integers, store them in a file. Then open the same file again for reading and calculate the number of lines, sum, and find the maximum number. Follow the steps bellow:

1. Create the method writeData(OutputStream out), to:

a. Create DataOutputStream object to be associated with out.

b. Read integer data from keyboard

c. Write data to out

d. Repeat steps b and c till end of file is read.

e. Close the DataOutputStream.

2. Create the method readData(InputStream in), to

a. Create DataInputStream object to be associated with in.

b. Read integer data from in.

c. Calculate the sum, max, and number of lines in the file

d. Repeat steps b and c till end of file is read.

e. Display the result (sum, max and number of lines) in the standard output device.

f. Close the DataInputStream.

3. In the main() method:

a. Create two Streams, one to read from the file "data" and one to write to it.

b. Call the writeData() method first, after that call readData()

c. Close both streams.

#2

اين محاولتك...

الموضوع سوف يغلق لانه مخالف خلال3 ايام..

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

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

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