المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ساعدوني في السي ++



sondos
25-10-2005, 12:41 PM
السلام عليكم


انا طالبة في قسم الحاسوب عندي واجب ومحتاجة المساعدة ساعدوني في تحليل هذا السؤا ل

الي فهمت ان البرنامج يسال المستخدم ثلاث اساله منها المستخدم راح يدخل ثلاث متغيرات للبرنامج

راح يكون في استخدام لل while بشرط ان الاجابة لا تساويs

بعدين راح يكون في استخدام ل if بحيث يسير بمسارين مرة اذا كانت الاجابة y راح يحسب ويطلع الاحصاءات المطلوبة ومرة اذا كانت الاجابة N ما راح يحسب

وبالحالتين راح يكتب عمر الزبون

سؤالي يكمن في فهمي للبرنامج صحيح ام لا؟

ارجو ان تقترحوا علي اسماء مناسبة للمتغيرات

اما برمجة السي ++ فلا تشيلون همها انشاء الله اكون قادرة عليها بس المهم اكون فاهمة البرنامج صح

اعتذر عن طول سؤالي يمكن يبين ممل



هذا السؤال المطروح علي اكثر شي استصعبته هو تحديد المتغبرات


A motor insurance company has surveyed a sample of its clients. The information

on each returned questionnaire includes the following:

o whether the client has had a claim in the last twelve months;

o the age of the client (in whole years at last birthday).



(Each returned questionnaire is referred to as a `return' for short.)

A program is required to analyse this information. A keyboard operator is to input

the data by responding to the following screen prompts.



Has the client claimed in the last 12 months?

Enter Y (for Yes), N (for No) or S (to stop processing):

and

Age of client?





When all data has been entered, the program is to output three numbers. These

are the total number of returns analysed, the number who have made a claim, and

the number who have made a claim and are under 25. Typical output might be as

follows.

Number of returns analysed = 685

Number of claimants = 131

Number of claimants who are under 25 = 79



The program is to be based on the following top-level design.



1 initialise variables

2 loop while there are more returns to be processed

3 process next return

4 loopend

5 write out results



Step 3 will involve reading in the data from the next return - a character value in response to the first prompt and an integer value in response to the second prompt - and updating counts accordingly. Note that the client's age is requested for all returns, not just for those where a claim has been made.




As it is not known in advance how many returns there are going to be, the loop will

have to be controlled by operator input. To indicate the end of input, the sentinel value `S' is to be entered in response to the first of the screen prompts.



a) Refine this design to a final design ready for coding into C++. You are to assume that the operator enters data correctly, so your design must not include any data validation. Submit your final design, which should include a data table, to your tutor. [15]



b) Open the skeleton project TMA01Q2.bpr in the Assignments subfolder. The MT262io library has been added to the project for you. Use the skeleton project to implement your design in part (a) as a C++ program. Compile, run and test your program. As your answer to this part, you should submit the following to your tutor:



· a printed listing of TMA01Q2U.cpp (which you can obtain by choosing

File|Print from Builder's main menu);

· printed output from one run of the program (see the preamble about

capturing program output for how to do this).



If you fail to achieve a working program, you should still submit your printed

program listing because marks will be awarded for aspects of the coding of

your design.



ثقتي فيكم كبيرة

وشكرا لكل المشاركين