Yurttas/PL/IL/Ada-95/ProgUnits/A/integrate 00.adb

From ZCubes Wiki
Jump to navigation Jump to search
 1--
 2-- Copyright (C) 1998
 3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4--
 5-- Permission to use, copy, modify, and distribute this 
 6-- software and its documentation for EDUCATIONAL purposes
 7-- and without fee is hereby granted provided that this 
 8-- copyright notice appears in all copies. 
 9-- 
10-- 
11 
12-- date   : January 1, 1998.
13-- author : Salih Yurttas.
14
15-- purpose : computation of the integral of two given functions
16--           using trapezoidal rule.
17
18-- integrate_00.adb
19
20
21with Text_IO;        use Text_IO;
22
23with Integrate_00_P; use Integrate_00_P;
24
25procedure Integrate_00 is
26
27  package Int_IO is new Integer_IO(Integer); use Int_IO;
28
29  package Flo_IO is new Float_IO(Float); use Flo_IO;
30
31  fv : Integer;
32
33  a,
34  b,
35  Area : Float;
36
37  procedure Integrate_F1 is new Integrate(F1);
38
39  procedure Integrate_F2 is new Integrate(F2);
40
41begin
42
43  Put("--> F 1 : ");
44  New_Line;
45  Put("-->   2 : ");
46  Get(fv);
47  Skip_Line;
48
49  New_Line;
50  Put("--> a : ");
51  Get(a);
52  Put("--> b : ");
53  Get(b);
54  Skip_Line;
55
56  case fv is
57    when 1      => Integrate_F1(a,b,Area);
58    when 2      => Integrate_F2(a,b,Area);
59    when others => null;
60  end case;
61
62  New_Line;
63
64  Put(" Integral of F");
65  Put(fv,1);
66  Put(" in between a = ");
67  Put(a,Fore=>3,Aft=>1,Exp=>0);
68  Put(" and b = ");
69  Put(b,Fore=>3,Aft=>1,Exp=>0);
70  Put(" is => ");
71  Put(Area,Fore=>5,Aft=>2,Exp=>0);
72  New_Line;
73
74end Integrate_00;