Nested Selection Structure Figure 5-6 shows a problem specification for a voter eligibility application. The application determines whether a person can vote and then displays one of three messages. The appropriate message depends on the person’s age and voter registration status. If the person is younger than 18 years old, the application should display the message “You are too young to vote.” However, if the person is at least 18 years old, it should display one of two messages. The correct message to display is determined by the person’s voter registration status. If the person is registered, then the appropriate message is “You can vote.”; otherwise, it is “You must register before you can vote.” Notice that determining the person’s voter registration status is important only after his or her age is determined. Because of this, the decision regarding the age is considered the primary decision, while the decision regarding the registration status is considered the secondary decision because whether it needs to be made depends on the result of the primary decision. A primary decision is always made by an outer selection structure, while a secondary decision is always made by a nested selection structure. Also included in Figure 5-6 is a correct solution to the problem in flowchart form. The first diamond in the flowchart represents the outer selection structure’s condition, which checks whether the age entered by the user is greater than or equal to 18. If the condition evaluates
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|