home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / menu / mmgr.tst < prev    next >
Encoding:
Text File  |  1988-05-03  |  12.5 KB  |  325 lines

  1. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. --SCORING.TXT
  3. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. package SCORING is
  5. --***************************************************************
  6. --*                       package SCORING is                    *
  7. --*     a demonstration of a possible use for the VIDEO tools   *
  8. --*     It allows users to create a CAI course complete with    *
  9. --*     rudimentary Scoring capability. This package is         *
  10. --*     accessed by the programs TOTAL, RIGHT and WRONG. It is  *
  11. --*     suggested that you use menus for questions, tying in    *
  12. --*     the program RIGHT for correct reponses(branches) and    *
  13. --*     WRONG for incorrect choices(branches). The program      *
  14. --*     TOTAL should be the last node in the linked list, and   *
  15. --*      will display to the user the number of correct,        *
  16. --*     incorrect reponses, and the number of tries.            *
  17. --*
  18. --*      Written by: Stephen J. Hyland
  19. --*      For:        AdaSoft, Inc.
  20. --*                  May, 1985
  21. --*
  22. --***************************************************************
  23.  
  24.   type VALUE is ( CORRECT, IN_CORRECT, TOTAL_IT );
  25.   procedure SCORE ( ANSWER : in VALUE );
  26. end SCORING;
  27.  
  28. with SEQUENTIAL_IO, TEXT_IO;
  29. package body SCORING is
  30.   type SCORE_REC is
  31.     record
  32.       RIGHT_ANSWER : INTEGER := 0;
  33.       WRONG_ANSWER : INTEGER := 0;
  34.       TOTAL_TRIES  : INTEGER := 0;
  35.     end record;
  36.  
  37.   package IO is new SEQUENTIAL_IO ( SCORE_REC );
  38.   use IO;
  39.   SCORE_FILE : FILE_TYPE;
  40.  
  41.   procedure GET_OLD_SCORE ( OLD_SCORE : in out SCORE_REC ) is
  42.   begin
  43.     OPEN ( SCORE_FILE, IN_FILE, "SCORE.DAT" );
  44.     READ ( SCORE_FILE, OLD_SCORE );
  45.     CLOSE ( SCORE_FILE );
  46.   exception
  47.     when others =>
  48.       CREATE ( SCORE_FILE, OUT_FILE, "SCORE.DAT" );
  49.       WRITE ( SCORE_FILE, OLD_SCORE );
  50.       CLOSE ( SCORE_FILE );
  51.   end GET_OLD_SCORE;
  52.  
  53.   procedure UPDATE_SCORE ( NEW_SCORE : in out SCORE_REC ) is
  54.   begin
  55.     OPEN ( SCORE_FILE, OUT_FILE, "SCORE.DAT" );
  56.     WRITE ( SCORE_FILE, NEW_SCORE );
  57.     CLOSE (SCORE_FILE );
  58.   end UPDATE_SCORE;
  59.  
  60.   procedure SCORE ( ANSWER : in VALUE ) is
  61.     use TEXT_IO;
  62.     MY_SCORE : SCORE_REC;
  63.   begin
  64.     GET_OLD_SCORE ( MY_SCORE );
  65.     MY_SCORE.TOTAL_TRIES := MY_SCORE.TOTAL_TRIES + 1;
  66.     case ANSWER is
  67.       when CORRECT =>
  68.         MY_SCORE.RIGHT_ANSWER := MY_SCORE.RIGHT_ANSWER + 1;
  69.         PUT ( "CORRECT" );
  70.         UPDATE_SCORE ( MY_SCORE );
  71.       when IN_CORRECT =>
  72.         MY_SCORE.WRONG_ANSWER := MY_SCORE.WRONG_ANSWER + 1;
  73.         PUT ( "WRONG" );
  74.         UPDATE_SCORE ( MY_SCORE );
  75.       when TOTAL_IT =>
  76.         MY_SCORE.RIGHT_ANSWER := MY_SCORE.RIGHT_ANSWER + 1;
  77.         PUT_LINE ( "CORRECT" );
  78.         PUT ( "You scored " & INTEGER'image(MY_SCORE.RIGHT_ANSWER) );
  79.         if MY_SCORE.RIGHT_ANSWER = 1 then
  80.           PUT ( " correct answer " );
  81.         else
  82.           PUT ( " correct answers " );
  83.         end if;
  84.         PUT ( " and " & INTEGER'image ( MY_SCORE.WRONG_ANSWER ) );
  85.         if MY_SCORE.WRONG_ANSWER = 1 then
  86.           PUT_LINE ( " wrong answer " );
  87.         else
  88.           PUT_LINE ( " wrong answers " );
  89.         end if;
  90.         PUT_LINE ( "Out of " & INTEGER'image ( MY_SCORE.TOTAL_TRIES ) &
  91.                    " tries." );
  92.         OPEN ( SCORE_FILE, IO.IN_FILE, "SCORE.DAT" );
  93.         DELETE ( SCORE_FILE );
  94.     end case;
  95.   end SCORE;
  96.  
  97. end SCORING;
  98. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  99. --WRONG.TXT
  100. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  101. --***************************************************************
  102. --*
  103. --*      Main Program: Wrong
  104. --*      Written by:   Stephen J. Hyland
  105. --*      For:          AdaSoft, Inc.
  106. --*                    May, 1985
  107. --*
  108. --*  Used in the Video Demo. Please look at the header for the
  109. --*  package Scoring.txt;
  110. --*
  111. --***************************************************************
  112.  
  113. with SCORING; use SCORING;
  114. procedure WRONG is
  115. begin
  116.   SCORE ( IN_CORRECT );
  117. end WRONG;
  118. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  119. --RIGHT.TXT
  120. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  121. --***************************************************************
  122. --*
  123. --*      Main Program: Right
  124. --*      Written by:   Stephen J. Hyland
  125. --*      For:          AdaSoft, Inc.
  126. --*                    May, 1985
  127. --*
  128. --*  Used in the Video Demo. Please look at the header for the
  129. --*  package Scoring.txt;
  130. --*
  131. --***************************************************************
  132.  
  133. with SCORING; use SCORING;
  134. procedure RIGHT is
  135. begin
  136.   SCORE ( CORRECT );
  137. end RIGHT;
  138. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  139. --TOTAL.TXT
  140. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  141. --***************************************************************
  142. --*
  143. --*      Main Program: Total
  144. --*      Written by:   Stephen J. Hyland
  145. --*      For:          AdaSoft, Inc.
  146. --*                    May, 1985
  147. --*
  148. --*  Used in the Video Demo. Please look at the header for the
  149. --*  package Scoring.txt;
  150. --*
  151. --***************************************************************
  152.  
  153. with SCORING; use SCORING;
  154. procedure TOTAL is
  155. begin
  156.   SCORE ( TOTAL_IT );
  157. end TOTAL;
  158. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  159. --INST1.TXT
  160. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  161.                       THE Ada PROGRAMMING LANGUAGE
  162.  
  163.     This is an interactive self-training program for the Ada language and
  164. it's associated concerns. The following commands will allow you to use this
  165. instructional course. 
  166.  
  167.     <CR>  -  go on to the next page or menu
  168.     </>   -  return to the previous menu or set of questions
  169.     <1-15>   select a topic or a multiple choice answer
  170.  
  171.     <T>   - end the session
  172.     <R>   - return to this page
  173. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  174. --INST2.TXT
  175. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  176.                          THE SOFTWARE CRISIS
  177.  
  178.     The development of a single high order language for the Department of 
  179. Defense was an extraordinary effort involving the coordination of literally 
  180. hundreds of agencies in academia, industry, and the federal government. The
  181. magnitude of the effort was anticipated; nevertheless, it was done because
  182. there seemed to be no other alternative to the crisis which was developing
  183. in software for the weapons systems delivered to the Department of Defense
  184. in the early 70's.
  185.  
  186.     The so-called "software crisis" was caused by many diverse factors, but
  187. the result was obvious to Department of Defense planners. The quality of the
  188. software being delivered and maintained by the military services was hindering
  189. our capability to maintain the state-of-the-art in weapons systems and
  190. leaving the United States vulnerable to our potential adversaries.
  191. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  192. --INST3.TXT
  193. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  194.        INCREASING DEMAND FOR SOFTWARE WITHIN THE DEPARTMENT OF DEFENSE
  195.  
  196.     The advent of sophisticated and powerful microprocessors in the late
  197. sixties and early seventies quickly led to smaller, more efficient, reliable
  198. and accurate weapons systems. Simultaneously, the Department of Defense was
  199. entrusting more and more of it's large scale information processing to
  200. Automated Data Processing.
  201.  
  202.     Major command and control systems were streamlined using the new
  203. technology, battlefield logistic systems were automated and ruggedized, and
  204. communications systems in all three of the military services were modernized.
  205. The demand for software to support these new Department of Defense systems
  206. grew rapidly.
  207. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  208. --INST4.TXT
  209. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  210.                                 SUMMARY
  211.  
  212.   In summary, the DOD software crisis has it's roots in the increasing 
  213. demand for sopisticated software for better weapons and  information
  214. systems. This demand reached over $6 billion annually in the early 1980's, 
  215. and is expected to grow considerably over the next decade. Presently, software 
  216. comprises approximately 85% of the overall DOD expenditures for ADP.
  217.  
  218.     By far, the greatest software cost is now for software maintenance --
  219. modifying existing software to meet emerging military requirements; however
  220. the quality of new software is also of great concern to the DOD. Sophisticated
  221. software produced under the rigid time constraints of defense requirements
  222. has been characteristically late, and often failed to perform as advertised.
  223. Additionally, much of the new software proved to be difficult if not 
  224. impossible to modify or rehost later in it's life cycle.
  225.  
  226.     Six fundamental weaknesses are at the heart of the software crisis, and
  227. continue to drive the price of acquisition up and the quality down -- a 
  228. characteristic lack of: responsiveness, timeliness, reliabliity, 
  229. transportability, modifiability, and efficiency.
  230. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  231. --MENU1.TXT
  232. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  233.  
  234.  
  235.                         THE Ada PROGRAMMING LANGUAGE
  236.  
  237.  
  238.  
  239.                            <1>  Study a Lesson
  240.  
  241.                            <2>  Reference a Concept
  242.  
  243.                            <3>  Review for Exam
  244. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  245. --MENU2.TXT
  246. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  247.  
  248.                        THE Ada PROGRAMMING LANGUAGE
  249.  
  250.                      Ada and the Department of Defense
  251.  
  252.                         <1>  THE SOFTWARE CRISIS
  253.  
  254.                         <2>  GOALS FOR SOFTWARE
  255.  
  256.                         <3>  PRINCIPLES FOR MODERN SOFTWARE ENGINEERING
  257.  
  258.                         <4>  HISTORY OF THE DEVELOPMENT OF Ada
  259.  
  260.                         <5>  GOVERNMENT REGULATIONS AND DIRECTIVES
  261. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  262. --MENU3.TXT
  263. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  264.                 
  265.                          THE SOFTWARE CRISIS
  266.  
  267.               <1>  Increasing Demand for Software
  268.               <2>  Increasing Costs
  269.               <3>  Software Hardware Ratio
  270.               <4>  Software Maintenance Costs
  271.               <5>  Other Major Software Costs
  272.               <6>  Problems in Software Development
  273.               <7>  Other Life Cycle Problems
  274.               <8>  Problems with Quality
  275.               <9>  Language Proliferation
  276.               <10> Summary
  277. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  278. --MENU4.TXT
  279. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  280.     The software crisis was a result of the rapid growth of computer
  281. technology in many fields. The Department of Defense is the largest single
  282. user of software in the world. Select the answer which correctly explains
  283. the increasing demand for software in the Department of Defense.
  284.  
  285.      <1>  Smaller weapons systems required more efficient software.
  286.  
  287.      <2>  Larger applications required more powerful software.
  288.  
  289.      <3>  More systms were being automated.
  290.  
  291.      <4>  All of the above.
  292.  
  293.      <5>  None of the above.
  294. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  295. --MENU5.TXT
  296. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  297.     Select the most accurate statement concerning the software crisis.
  298.  
  299.     <1> Several fundamental weaknesses in software development are at the 
  300.         heart of the problem.
  301.  
  302.     <2> As more powerful and diverse high order languages are developed
  303.         many of the problems are lessened.
  304.  
  305.     <3> As more powerful hardware is developed, software problems will
  306.         continue to lessen.
  307.  
  308.     <4> All of the above.
  309. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  310. --COMPDEMO.COM
  311. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  312. $ada scoring,wrong,right,total
  313. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  314. --DEMO.COM
  315. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  316. $  set term/noecho
  317. $  create VIDEO.DAT
  318. [CONTR04]DEMO.DAT
  319. $  assign sys$command: sys$input
  320. $  trun video
  321. $  set term/echo
  322. $  delete VIDEO.DAT;*
  323. $  exit
  324.  
  325.