DataStructure 2025
116 subscribers
25 photos
2 videos
44 files
21 links
Download Telegram
طلاب التحميل محاضرتكم ثابتة
يوم الاربعاء ساعه ١٢:٣٠
غير مطالبين بالحضور مطالبين فقط بالواجبات
👍2
package javaapplication42;
import java.io.*;
import java.util.Scanner;

class Project1 {

static void writeToFile(String fileName){
try{
Scanner cin= new Scanner (System.in);
FileWriter f = new FileWriter(fileName, true);
PrintWriter file = new PrintWriter(f);
String line;
System.out.println ("WRITE TEXT as Line by Line .... for stop write 'stop' ");
line= cin.nextLine();
while (!line.equals("stop")){
file.println(line);
line= cin.nextLine();}
file.close();}
catch (IOException e){ System.out.println("Error"); }
}//writeToFile

static void readFile(String fileName){
try{
FileReader f = new FileReader(fileName);
BufferedReader file = new BufferedReader(f);
String line;
line= file.readLine();
while (line!=null){
System.out.println(line);
line=file.readLine();}
file.close();}
catch (IOException e){ System.out.println("Error"); }
}//readFile


static int FindNumberofLine(String fileName){
int linesNo=0;
try{
FileReader f = new FileReader(fileName);
BufferedReader file = new BufferedReader(f);
String line;
line= file.readLine();
while (line!=null){
linesNo++;
line=file.readLine();}
file.close();}
catch (IOException e){ System.out.println("Error"); }
System.out.println("number of line ::: "+linesNo);
return linesNo;
}//FindNumberofLine

//Method to get File Information
static void getFileInfo(String fileName) {
File myFile = new File(fileName);
if (myFile.exists()) {
System.out.println("File name: " + myFile.getName());
System.out.println("Absolute path: " + myFile.getAbsolutePath());
System.out.println("File size in bytes " + myFile.length());}

else {System.out.println("The file does not exist.");}
}//getFileInfo


static void modifyLine(String fileName, String newLine, int lineNo){
try{
FileReader fR = new FileReader(fileName);
BufferedReader fileR = new BufferedReader(fR);
FileWriter fW = new FileWriter("temp.txt", true);
PrintWriter fileW = new PrintWriter(fW);
String line;
int lineNumber=0;
line= fileR.readLine();
while (line!=null){
lineNumber++;
if (lineNumber==lineNo)
fileW.println(newLine);
else
fileW.println(line);
line=fileR.readLine();}
fileW.close();
fileR.close();}
catch (IOException e){ System.out.println("Error"); }
}//readFile
static void screen(){
System.out.println("1. Write to File");
System.out.println("2. Read from File");
System.out.println("3. Find number of line in File");
System.out.println("4. Modify given Line Number");
System.out.println("5. File Information");
System.out.println("0. Exit");
System.out.print("Please Enter 1...5 ::::");
}//Screen

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String fName;
screen();
int choice = in.nextInt();
while (choice>=1 && choice <=5){
Scanner cin = new Scanner(System.in);
switch (choice){
case 1: System.out.print("Enter File Name :: ");
fName= cin.nextLine();// read name of file
writeToFile(fName); break;

case 2: System.out.print("Enter File Name :: ");
fName= cin.nextLine();// read name of file
readFile(fName); break;

case 3: System.out.print("Enter File Name :: ");
fName= cin.nextLine();// read name of file
FindNumberofLine(fName); break;

case 4: System.out.print("Enter File Name :: ");
fName = cin.nextLine();// read name of file
int lineNo; String newLine;
System.out.print("Enter new Line :: ");
newLine = cin.nextLine();
System.
🤯21
out.print("Line Number :: ");
lineNo = cin.nextInt();
modifyLine(fName, newLine, lineNo); break;

case 5: System.out.print("Enter File Name :: ");
fName= cin.nextLine();// read name of file
getFileInfo(fName); break;


default : System.out.println("OUT OF RANGE ");
}//switch
screen();
choice = in.nextInt();
}//while

System.out.print("Finish the processes ");

}//main
}//Project1
🤯4😢21
البرنامج الرئيسي للمصفوفات.. بحيث كل مهمة تعطى لك تضاف الى الكود

الرسالة من الكلاس
🤯81
طلاب الكلاس انفتح لمدة يومين
الطلاب الي ما انضمو علي ينضمون
الاسم الثلاثي بالعربي
🤯2
r7wc7ho
م.م مـؤمل ميثاق الحلفي ️🧑‍💻 ️️
r7wc7ho
جربو هذا الكود
طلاب التحميل فقطط
هذا التبليغ الكم

https://docs.google.com/forms/d/e/1FAIpQLSdAKKez9C34B9xvIk0cT0V5_Qvd72_1uSc7vHEkuPKJdcabTA/viewform?usp=header

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

لان مو حالة هاي هم ازدحام هم اغلب الطلاب من اطراف البصره وهم مايقبلون ب٨:٣٠ يسوون المحاضره
👍6
طلاب المجموعة الاولى ساعه ٨:٠٠
المجموعة الثانية بعدهم ما رادين ع الموعد مالتها من يردون ابلغكم
واذا ردو خبر باجر ابلغكم بالدوام والماعنده نت خلي يتصل علي
صباح الخير
طلاب مدة المحاضره ساعه واحده فقط حسب تبليغ القسم
المجموعه الاولى ب8
المجموعة الثانية ب9
5
طلاب هذا فورم المشروع
المشروع يكون عبارة عن لعبة او تطبيق باحد لغات البرمجة
موعد التسليم ما مبلغين بي لحد الان
👍2😢21
طلاب الكل مطالب تحميل مو تحميل الكل مطالب بالمشروعع
😢1
Forwarded from داتا ستركجر تحميل (مـؤمل الحلفي ️️)
كود اليوم
طبقنا الinsert وbubble
Forwarded from داتا ستركجر تحميل (مـؤمل الحلفي ️️)
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/

package com.mycompany.mavenproject18;
import static com.mycompany.mavenproject18.NewClass.insertionSort;
import java.util.*;
/**
*
* @author ALAMAT
*/
public class Mavenproject18 {



public static void main(String[] args) {

int[] data = {19, 1, 2, 5, 6}; // مصفوفة البيانات
insertionSort(data); // استدعاء دالة الفرز

for (int num : data) {
System.out.print(num + " "); // طباعة العناصر المرتبة
}
}
}
Forwarded from داتا ستركجر تحميل (مـؤمل الحلفي ️️)
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.mycompany.mavenproject18;

/**
*
* @author ALAMAT
*/
public class NewClass {
public static void insertionSort(int[] arr) {
// نقوم بالتكرار من العنصر الثاني إلى نهاية المصفوفة
for (int i = 1; i < arr.length; i++) {
int key = arr[i]; // نأخذ العنصر الحالي (المفتاح)
int j = i - 1; // نبدأ من العنصر السابق للمفتاح

// نقوم بتحريك العناصر الأكبر من المفتاح إلى اليمين
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j]; // نُحرك العنصر إلى اليمين
j--; // نتجه إلى العنصر السابق
}
arr[j + 1] = key; // نُدخل المفتاح في مكانه الصحيح
}
}}
Forwarded from داتا ستركجر تحميل (مـؤمل الحلفي ️️)
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/

package com.mycompany.mavenproject23;

import static com.mycompany.mavenproject23.bubbleSort.BubbleSort;




/**
*
* @author ALAMAT
*/
public class Mavenproject23 {

public static void main(String[] args) {
int[] data = {64, 34, 25, 12, 22, 11, 90}; // مصفوفة البيانات
BubbleSort(data); // استدعاء دالة الفرز
System.out.print("المصفوفة مرتبة هي: ");
for (int num : data) {
System.out.print(num + " "); // طباعة العناصر المرتبة
}}


}
Forwarded from داتا ستركجر تحميل (مـؤمل الحلفي ️️)
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.mycompany.mavenproject23;

/**
*
* @author ALAMAT
*/
public class bubbleSort {
public static void BubbleSort(int[] arr) {
int n = arr.length;
// نقوم بتكرار المصفوفة n-1 مرات
for (int i = 0; i < n - 1; i++) {
// نقوم بعمليات المقارنة داخل المصفوفة
for (int j = 0; j < n - i - 1; j++) {
// إذا كان العنصر الحالي أكبر من العنصر التالي، نقوم بتبديلهما
if (arr[j] > arr[j + 1]) {
// تبديل القيم
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}}}}
👏1
واجبكم مال باجر
الكود من احد الطلاب مو من الدكتورة ما مسؤول عن اي خطأ بي