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

ارجو المساعده بليييييييييييز

مغلق
بدأه دلوعة الجافا في 28 فبراير 2006 · 2 رد · 512 مشاهدة · في 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.

محاولتي بس ما عرفت كيف اكمل الباقي:

import java.io.*;

public class Ass02{
	public static void main(String [] args){
  try{

  DataOutputStream out = new DataOutputStream(new FileOutputStream("data"));
  writeData(out);
	}catch(IOException ioe){}
	}//main
	//read byte from keyboard and write integer to file
	public static void writeData(OutputStream o) throws IOException{
  DataOutputStream oStream = (DataOutputStream) o;
  InputStream key = System.in;
  int data = key.read();
  oStream.writeInt(data);
  oStream.close();
	}//writedata
}

اتمنى تساعدوني

تم تعديل هذه المشاركة بواسطة دلوعة الجافا في 28 فبراير 2006 في 18:40

#2

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

اتمنى احد يرد على سؤالي لاني حاولت احله

و شكرا

#3

i solve it thanks

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

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