Yurttas/PL/IL/Ada-95/ProgUnits/A/integrate 01.adb
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_01.adb
19
20
21with Text_IO; use Text_IO;
22
23with Functions_00_P; use Functions_00_P;
24with Integrate_01_P; use Integrate_01_P;
25
26procedure Integrate_01 is
27
28 package Int_IO is new Integer_IO(Integer); use Int_IO;
29
30 package Flo_IO is new Float_IO(Float); use Flo_IO;
31
32 fv : Integer;
33
34 a,
35 b,
36 Area : Float;
37
38 procedure Integrate_F1 is new Integrate(F1);
39
40 procedure Integrate_F2 is new Integrate(F2);
41
42begin
43
44 Put("--> F 1 : ");
45 New_Line;
46 Put("--> 2 : ");
47 Get(fv);
48 Skip_Line;
49
50 New_Line;
51 Put("--> a : ");
52 Get(a);
53 Put("--> b : ");
54 Get(b);
55 Skip_Line;
56
57 case fv is
58 when 1 => Integrate_F1(a,b,Area);
59 when 2 => Integrate_F2(a,b,Area);
60 when others => null;
61 end case;
62
63 New_Line;
64
65 Put(" Integral of F");
66 Put(fv,1);
67 Put(" in between a = ");
68 Put(a,Fore=>3,Aft=>1,Exp=>0);
69 Put(" and b = ");
70 Put(b,Fore=>3,Aft=>1,Exp=>0);
71 Put(" is => ");
72 Put(Area,Fore=>5,Aft=>2,Exp=>0);
73 New_Line;
74
75end Integrate_01;