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

[مخالف - طلب حل : ]مشروع صغير

مغلق
بدأه turkyha في 28 ديسمبر 2008 · 1 رد · 358 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بســم الله الـرحمــن الرحيــم

السلام عليكم ورحمه الله وبركاته ،،، :wink:

أخواني الأعزاء ... مفكرين العرب

لن أطيل عليكم ... لدي تمرين أردت أن أضعه بين أنامكم البرمجية أعطاني إياه أحد الأشخاص في تحدي لحله وذلك لصقل المواهب والتدريب :huh:

التمرين : -_-

Question 1

This question is based on Unit 1. It tests your ability to work with records, arrays and loops.

A company working on selling project consultancies wishes to keep information about its employees and their salaries. For each employee, the needed information is the following:

- name

- age

- job title

- position rank

- salary

- civil status (single, married, divorced)

- number of children

The name, the title and the civil status are to be held as string values. The position rank, the age and the number of children are to be held as integer values. The salary of the employee is a float.

  • Give a C++ declaration of a record type Employee Type to hold this information on employees. Also give a C++ declaration Employees List to hold the information on all employees in the form of a table. The maximum number of employees is 25.

  • Write down the C++ code statements which assign, at index 12 in EmployeesList information on a newly recruited employee. The new employee name is John Wain, he is 38 years old, he will be in charge of managing the advertisement department, he reports to the general manager so his rank in the company is 2; the contract stated that the annual salary of John is 50.000 dollars a year. He is e and has three children.

  • Write down C++ code statements to fill in the employees' list information about 5 employees. Your name should be one of these employees. The other names should not include any of your colleagues' names. (Otherwise, you will be penalized).

  • <LI class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: 150%; TEXT-ALIGN: justify; mso-layout-grid-align: none; mso-list: l2 level1 lfo2; tab-stops: list .5in">Write a fragment of C++ code whose purpose is to search EmployeeList in order to:
    • <LI class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: 150%; TEXT-ALIGN: justify; mso-layout-grid-align: none; mso-list: l2 level2 lfo2; tab-stops: list 1.0in">Search the details for a given name of employee. The fragment is to receive a string value, from the keyboard and is to search the table for an item with that name. If this item exists, the description and the employee's details should be written out. If no such employee exists, a report to that effect should be written out instead. <LI class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: 150%; TEXT-ALIGN: justify; mso-layout-grid-align: none; mso-list: l2 level2 lfo2; tab-stops: list 1.0in">Search for the name of the employee with the highest salary.
    • Find the number of married employees.
    • Count the number of children for all the employees.

  • <LI class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: 150%; TEXT-ALIGN: justify; mso-layout-grid-align: none; mso-list: l2 level1 lfo2; tab-stops: list .5in">Write a fragment of C++ code whose purpose is to search EmployeeList and to write out a list of all the employees with rank 3 and salary above 27000$. For each such employee all the corresponding details should be written out.
  • Write a fragment of C++ code whose purpose is to search EmployeeList and to write out a list of all the employees that are not married but have children.

Question 2

This question tests your ability to test and use functions and to implement them.

Consider the structure you implemented in question one.

This question is concerned with two functions, SortByName and SortBySalary, which are specified as follows:

SortByName

EmployeeList list

This function should sort the employee list elements in an ascending order with respect to their names.

SortBySalary

EmployeeList list

The purpose of this function is to sort the employees in the employees list with respect to their salary in an ascending order.

a- Write the C++ code that implements SortByName and SortBySalary functions.

b- Write the C++ fragment code to call and test the previous functions.

c- Suppose that the user has been mistaken in entering the names. Write the C++ code of a function that allows the user to modify any of the EmployeeList elements by providing the name of the employee the user wants to change the details.

d- Write the C++ code of a function that assigns the highest salary to the employee of lowest salary, and the lowest salary to the employee of highest salary.

Question 3

This question is based on Unit 3. It tests your ability to write a class.

In this question, you are not expected submit a Builder C++ program using your computer. You should provide your answers listing in a word document file. You can, of course, implement your answer and test them if you wish, but you should not submit any evidence for testing.

The company of Question 1 wishes to modernize the software for keeping records of its employees by using a class instead of the table structure as before. To this end, your help is needed to create a suitable class EmployeeType. It is decided that the same details of data as in Question 1 should be held by an object of this type, namely:

- name

- age

- job title

- position rank

- salary

- civil status (single, married, divorced)

- number of children

These details should now be implemented as the data members of the new class and should no longer be held inside a table structure.

The company identifies the following methods for inclusion in the class:

- A method to initialize an EmployeeType object. Values for the name and the description data members will need to be supplied as parameters.

- Two setter methods, one each for the age and number of children data members, assigning values supplied as parameters. For example, a method SetAge will take an integer number as parameter and assign this value to the age data member.

- Seven getter methods returning the values of data members. For example, a method GetName will return the value of the name data member.

- A method for married. When and employee is married, the method should update the civil status accordingly.

  • Write a declaration for the class EmployeeType. This involves specifying the data members and giving prototypes for the methods. For example, the method SetAge might have prototype:

void SetAge(int AgeOfEmployee)

  • The code for the method SetAge would have the following template.

void Employeetype::SetAge(int AgeOfEmployee)

{

// code to assign AgeOfEmployee to the appropriate data member

}

Give code to implement the following methods of EmployeeType declared in part (a): the initialize method, the method to set the employee's age, the method to return the employee' name, the title, the rank, the age, the salary, the civil status and the number of children methods.

انتظر ردودكم

لكم مني كل الود :happy:

#2

الأخ الكريم/الأخت الكريمة

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

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات، فقرة طلب حل الواجبات والتمارين وأعمال السنة.

قواعد طرح المشاركات

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

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

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