Question: Task 4 - For the following Ada program, add a precondition in procedure DB_Entry to check the person's name is not an empty string, and

 Task 4 - For the following Ada program, add a precondition

Task 4 - For the following Ada program, add a precondition in procedure DB_Entry to check the person's name is not an empty string, and the person's age is between 1 and 130; add a postcondition to check the person's age is between 1 and 130. with Ada. Text_10; use Ada. Text_10; procedure jdoodle is Hint: add pragma Assertion_Policy statement here procedure DB_Entry (Name : String; Age : in out Integer) Hint: add pre and post -- statement here is begin Age := Age + 50; Put_Line (Name); end DB_Entry; currentage : Integer; begin currentage := 3; DB_Entry ("John", currentage); currentage := 125; DB_Entry("", currentage); end jdoodle; I Reference https://learn.adacore.com/courses/intro-to-ada/chapters/contracts.html for adding pre and post statement immediately following procedure DB_Entry. Refer https://gcc.gnu.org/onlinedocs/gnat rm/Pragma-Assertion 005fPolicy.html for letting the compiler to do both pre and post check. Add the following statement immediately before procedure DB_Entry: pragma Assertion_Policy(Pre => Check, Post => Check); You may want to use this online Ada compiler https://www.jdoodle.com/execute-ada-online/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!