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

مساعدة في linked list - stack

بدأه rahmony في 18 ديسمبر 2013 · 0 رد · 707 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1

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


 


 


يسعد مساكم ..


 


 


احد الزملاء لديه 3 برامج في الـ linked list - stack  وللاسف م زلت مبتدي في الجافا ولا استطيع مساعدته


كما انها متعلقة بـ Data Structures و لم ادرس هذي المادة بعد !!


لذا توجهت للمنتدانا الرائع واتنمى ان اجد الدعم والمساعدة راح ارفق لك المطلوب


و محاولة زميلي وانتظر نصائحكم و توجيهاتكم ..


Project 1


Write a java program to create an array which stores the objects of the Student class. Number of Student objects and information for each attribute should be taken as input from the user through command prompt. Parse the array and create a file for each student object. The name of the file should be of the format F_StudentId.txt. The StudentId should be unique and the uniqueness should be checked while the input is given by the user. The output file should have the following info.


Name

Sex

Age

DateofBirth

NumberofSubjects

FinalGrade.


Compute the average marks obtained by the student and apply the following rules to decide the Final grade


   Averagemarks >=95    Final Grade = A+

   Averagemarks >=90    Final Grade = A

   Averagemaraks >=80   Final Grade = B

   Averagemarks >=70   Final Grade = C+

   Averagemarks >=60   Final Grade = C

   Averagemarks >=50  FinalGrade = D

   Averagemarks >=40  FinalGrade = E

   Averagemarks < 40   FinalGrade =Fail



public class Student

{

     String name;


     int studentId;  


     char sex;


     int age;


     String dateofbirth;


     String number_of_subjects;


     String [] subject_names;


     int [] subject_marks; 


}









Project 2


Write a java program to create a linked list of employee objects. The information for each employee object will be read from a file employee.txt where each line represents an employee object.The linked list should be created as per the user’s choice depending on the Following criteria. 

A)	Salary Limit: The user will enter a salary limit SL and the linked list should contain only the employee objects with salary >= SL.

B)	Employee ID: Even or Odd. The linked list should be created with Employee objects having even Employee_Id or Odd Employee_Id as per the user’s choice.


C)	Sex; The linked list should be created with male (m) employee objects or female(f) employee objects.


D)	City. The linked list should be created with the employee objects of a particular city given by the user. For e.g City = “Madinah”.


Finally parse linked list and dump the information into a file. The name of the file depends on user’s criteria as discussed above. The possible file names/formats are:


A)	For salary limit criteria, the filename format is F_Salary_Limit_SL.txt where SL is a variable i.e for e.g if SL = 3000 the filename should be F_Salary_Limit_3000.txt.


B)	For Employee ID criteria, the filename will be  F_Employee_ID_Even.txt or F_Employee_Id_Odd.txt.


C)	For sex criteria the filename will be F_m.txt or F_f.txt.


D)	For city criteria the file format is F_City.txt for e.g if city  = “Madinah” the output file will be F_Madinah.txt.

public class Employee 

{   

    String name;

    int id;

    char sex;

    int age;

    String city;

    int salary;

    String department;        

}


Input File format:


Omar      92786 M  35  Madinah  20000 Copmputers

Osama     92785 M  25  Riyadh   12000 Electronics

Abdullah  92783 M  38  Madinah  24000 InformationScience









Project 3


Write a java program to read input from two files representing Product Id and ProductName respectively. The first will have all product ids and each line will contain a integer number. The second file will have the product names and each line will contain a string. The number of lines in both the files should be equal. Read the input and create a stack of numbers (SN), stack of strings (SST) for even product ID’s  and , queue of numbers QN and queue of strings QST for odd product Id’s. Parse both the stacks and dump the both the product id and name in one file named stack.txt with even product id’s. Further parse both the queues and dump the information product id and product name in one file named queue.txt with odd product id’s.


Input File Format for file1 product_ids.txt


100

200

300

400

500

Input File Format for file2 product_name.txt

 computer

 desktop

 keyboard

 mouse 

 hundaisantro 


Output File Stack.txt


400 mouse 

200 desktop.


Outputfile queue.txt


100 computer

300 keyboard

500 hundaisantro

في المرفقات الاكواد ..


 


 


دمتم بحفظ الله

Datastruct_Proj1.rar

DataStruct_Proj2.rar

DataStructures_Proj3.rar

تم تعديل هذه المشاركة بواسطة rahmony في 18 ديسمبر 2013 في 21:30

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