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

الرجاء المساعدة في هذا البرنامج

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

أولا :المطلوب هو:

You are required to develop a simple student/staff information system in Java that can read input information about students and staff.

The student information consists of his id, name and letter grades. The number of letter grades can be one or more.

The staff information consists of his id, name, basic salary and allowances and deductions (e.g., phone bill, medical bill). The number of allowances can be one or more. The number of deductions can be one or more.

The above information should be stored in a file input.txt in the format shown below

stud = id: 999999, name: Ali Ahmad Al-Qahtani, grades: B+ & C & A

staff = id: 111, name: Muhammad Jumma Anazi, basic: 5600, allow: 200 & 450, ded: 145

stud = id: 988888, name: Muhammad, grades: A+ & D & C+ & D+

stud = id: 888, name: Fahad Bader, grades: B+ & A

staff = id: 236, name: Mousa Baqshan, basic: 13560, allow: 795, ded: 675 & 120 & 78

After finishing input reading, the program should process the above file input.txt and saves the two types of records in two different files:

Student records should be saved in a file stud.txt

999999, Ali Ahmad Al-Qahtani, GPA = 3.166

988888, Muhammad, GPA = 2.25

888, name: Fahad Bader, GPA = 3.625

Staff records should be saved in a file staff.txt

111, Muhammad Jumma Anazi, Net Salaray = 6,105

236, Mousa Baqshan, 13560, Net Salaray = 13,482

--------------------------------------------------------------------------------

About the program output

When the program is started, it should display a Main Menu on screen (as shown below)

Enter Record

Process the file input.txt

Exit Program

If users chooses '1', the program asks from the user

what type of record you want to enter:

Student

Staff

If user chooses 1, the program reads the information as shown below.

Enter ID : 9999

Enter Name: AbdulMajeed

Enter letter gardes (Z to stop)

A+

C

Z

If user chooses 2, the program reads the information as shown below:

Enter ID : 123

Enter Name: Hassan Al-Ghamdi

Enter Basic Salary: 4500

Enter Allowances (-1 to stop)

120

-1

Enter deduction (-1 to stop)

60

35

-1

If user chooses option '2', the file input.txt is processed, and files stud.txt & staff.txt are updated.

If user chooses option '3' without first choosing option '2', the program should display a warning message that "file input.txt has not been processed, Do you want to exit ?".

After a record has been entered, the program should display another menu on screen (as shown below)

Display record values

Modify record values

Save record in file input.txt

Go back to Main Menu

If user chooses option '1', the entered record values are displayed on screen.

If user chooses option '2', the program displays another menu on screen depending on the type of current record. (as shown below)

If current record is student If current record is staff

What you want to change

Id

Name

Grades

What you want to change

Id

Name

Salary

Allowances

Deductions

If user chooses option '3', the entered record is saved to the file input.txt. Note: The entered record is not saved to the file until user selects option '3' from the menu.

If user selects option '4' without first selecting option '3', the program should display a warning message that "Record is not saved, Do you want to continue without saving ?".

--------------------------------------------------------------------------------

IMPORTANT

All types of exceptions should be handled by using try-catch

The program should be able to handle all type of input errors at any step of the program.

ثُانيا:هدا ما توصلت إيه ولكنه مليء بالأخطاء

import java.io.*;

import java.util.*;

public class Project

{

public static void main (String[] args) throws IOException

{

BufferedReader inputStream = new BufferedReader(new FileReader("input1.txt"));

StringTokenizer tokenizer = new StringTokenizer(inputStream.read(),"=,&");

while((inputLine = inputStream.readLine()) != null){

tokenizer = new StringTokenizer(inputLine);

{

String kind = new StringTokenizer(s);

String id;

String grade;

String name;

String salary;

String allow;

String ded;

if (kind=="stud")

{

String id = s.nextToken(",");

String name = s.nextToken(",");

String grade=s.nextToken();

}

else {

String id = s.nextToken(",");

String name = s.nextToken(",");

String salary = s.nextToken(",");

String allow = s.nextToken(",");

String ded = s.nextToken();

}

}

while(tokenizer.hasMoreTokens()){

String token = tokenizer.nextToken();

}

System.out.println("press : 1,2 or3");

System.out.println("1.Enter record");

System.out.println("2.Process the file inbox.txt");

System.out.println("3.exit program");

switch (number)

{

case 1 :System.out.println("what type of record you want to enter: ");

System.out.println("1.student ");

System.out.println("2.staff ");

switch (type){

case 1:System.out.println("Enter ID : ");

System.out.println("Enter name ");

System.out.println("Enter letter grade(Z to stop");break;

case 2:System.out.println("Enter ID : ");

System.out.println("Enter name");

System.out.println("Enter Basic Salary: ");

System.out.println("Enter Allowances (-1 to stop)");

System.out.println("Enter deduction (-1 to stop)");break;

defult: System.out.println("wrong input");

} break;

case 2: System.out.println("1.Display record values");

System.out.println("2.Modify record values ");

System.out.println("3.Enter Basic Salary: ");

System.out.println("4.Save record in file input.txt ");

System.out.println("5.Go back to Main Menu");

switch(option){

case 1: System.out.println("entered record ");break;

case 2: if (student) System.out.println("What you want to change ");

System.out.println("1.ID ");

System.out.println("2.Name ");

System.out.println("3.Grade");

switch(student){

case 1:

case 2:

case 3:

defult

}

else System.out.println("What you want to change ");

System.out.println("1.ID ");

System.out.println("2.Name ");

System.out.println("3.salary");

System.out.println("4.allowance ");

System.out.println("5.detaction ");

switch(staff){

case 1:

case 2:

case 3:

case 4:

case 5:

defult

}

defult

}

case 3:print writer

case 4: System.out.println("what type of record you want to enter: ");

System.out.println("1.student ");

System.out.println("2.staff ");

defult }

الرجاء المساعدة

#2

القسم موجود للمساعدة و ليست لكتابة و حل الواجبات و المشاريع ..

يعني ممكن نساعدك بالافكار و بعض الامور الاخرى ... اما اننا نشتغل بالمشروع فما راح انت تستفيد ..

ثاني شئ: انت تدرس ICS102 ؟

#3

السلام عليكم

أولا أخي العزيز مشكور على النصيحة

لكن أنا ما طلبت أن تسوي لي البروجكت

أنا زي ما أنت شابف حاولت لكن في حاجات ما عرفت أسويها وأنا أبغى مجرد هنت بسيط يوصلني للحل

ثانيا:

نعم أنا طالب ics102

وشكرا

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

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