[go: up one dir, main page]

0% found this document useful (0 votes)
224 views152 pages

Group H (Sn.8) Lab Report

The document is a lab report for a health informatics course. It contains 7 programming problems in C with the problem definitions, algorithms, flowcharts, source code, and outputs for each one. The problems cover topics like determining if a number is odd or even, finding the largest of two numbers, multiplication and division of numbers, summing series, summing squares and cubes of natural numbers. For each problem, the student provides the logic and code to solve it.

Uploaded by

Nishrita Devnath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views152 pages

Group H (Sn.8) Lab Report

The document is a lab report for a health informatics course. It contains 7 programming problems in C with the problem definitions, algorithms, flowcharts, source code, and outputs for each one. The problems cover topics like determining if a number is odd or even, finding the largest of two numbers, multiplication and division of numbers, summing series, summing squares and cubes of natural numbers. For each problem, the student provides the logic and code to solve it.

Uploaded by

Nishrita Devnath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 152

Practical: Health Informatics

Jahangirnagar University

Department/Institute: Department of Public Health and Informatics.

Honours 3rd year Final Examination-2019

Lab-report for Final Examination

Course No.# PHI 313

Course Title#

Name of the Students:

Class Roll No. #

Examination Roll No. #

Registration No. #

Academic Session # 2016-2017

Total number of written pages in the report #

Date of Submission: 2nd, November 2021

Instructions:
1. Don’t copy from other’s assignment. Copying from others will be punished
severely.
2. The student must submit the assignment online (Google
classroom/email/google form etc.) as the course-teacher prescribes.
3. You must use your name# your EXAM ID only for naming your submitted
file.

1|Page
Lab Report 2:
C

Programming

1. Write a C program which displays whether a number is odd or even.

A. Problem definition:
An even number is a number which has a remainder of 0 upon division by 2, while an odd
number is a number which has a remainder of 1 upon division by 2. Now if we understand the
definitions of Odd and Even Number properly, we can easily conclude that if a number is exactly
divisible by 2, then the number is considered as an even number else the number will be
considered as an odd number.

B. Algorithm:
o Step 1: Start
o Step 2: [Take Input] Read: Number
o Step 3: Check: If Number%2 == 0 Then
o Print: N is an Even Number.
o Else
o Print: N is an Odd Number
o Step 4: Stop
C. Flowchart:

2|Page
D. Source Code:
#include<stdio.h>
int main()
{
int n;
printf("Enter your number:");
scanf("%d",&n);
if(n%2==1)
printf("\nNumber is odd\n\n");
else printf("\nNumber is even\n\n");
return 0;

3|Page
}

E. Output:

2. Write a C program which computes the largest number between two numbers.

A. Problem definition:
The problem is to find largest of two given numbers is discussed here. Input two integers from
the user and find the largest number among them. Given two numbers num1 and num2. The
task is to find the largest number among the two.

B. Algorithm:
o Step1: Start
o Step2: Enter first number as No1
o Step3: Enter second Number as No2
o Step4: Check if (No1>No2) then Print No1 is biggest number
Else Print No2 is biggest number

4|Page
o Step5: Stop

C. Flowchart:

D. Source Code:
#include<stdio.h>
int main()
{
int a,b;
printf("Enter your first number:");
scanf("%d",&a);
printf("Enter your second number:");
scanf("%d",&b);

5|Page
//printf("Enter two numbers to add\n");
//scanf("%d%d", &a, &b);
if(a>b)
printf("%d is greater\n",a);
else printf("%d is greater",b);
return 0;
}

E. Output:

3. Write a Program in C which displays multiplication of two numbers.

A. Problem Definition:

6|Page
Multiplication, one of the four basic operations of arithmetic, gives the result of combining
groups of equal sizes. In other words, multiplication is repeated addition. Multiplication is
represented by the signs cross '×', asterisk '*' or dot '·'. When we multiply two numbers, the
answer we get is called 'product’. The product of two numbers is the result that we get when
we multiply them together.
B. Algorithm:

o Step 1: Start
o Step 2: Read a,b
o Step 4: c=a*b
o Step 5: Print c
o Step 6: Stop
C. Flowchart:

7|Page
D. Source code:

#include<stdio.h>
int main()
{
int a,b,c;

printf("Enter your first number:");


scanf("%d",&a);
printf("Enter your second number:");
scanf("%d",&b);
//printf("Enter two numbers to mul\n");
//scanf("%d%d", &a, &b);
c=a*b;
printf("\nMultiplication of two numbers are:%d\n",c);
return 0;
}
E. Output:

8|Page
4. Write a Program in C which displays division of two numbers.

A. Problem definition:
In C language, when we divide two integers, we get an integer result, e.g., 5/2 evaluates to 2.
As a rule, integer/integer = integer, float/integer = float and integer/float = float. So, we
convert denominator to float in our program, you may also write float in the numerator. This
explicit conversion is known as typecasting.

B. Algorithm:
o Step 1: Start
o Step 2: Input a,b
o Step 4: c=a/b
o Step 3: if(b=0) Display “Enter a non-zero number”
o else Display c
o Step 5: Stop
C. Flowchart:

9|Page
D. Source code:

#include<stdio.h>
int main()
{
int a,b;
float div;
printf("Enter your first number:");
scanf("%d",&a);
printf("Enter your second number:");
scanf("%d",&b);
//printf("Enter two numbers to add\n");
//scanf("%d%d", &a, &b);
/*div defined as a float & cast any one variable a or b.*/
div=a/(float)b; //b cast as float
if (b>0)
printf("\nDivision of two numbers are:%f\n",div);
else printf("No Division");
return 0;
}

E. Output:

10 | P a g e
5. Write a C program
which sum of the series
1+2+3+4+

…………………. +100

A. Problem definition:
The n-th partial sum of a series is the sum of the first n terms. The sequence of partial sums of
a series sometimes tends to a real limit. Sum of the series 1 + 2 + 3 + … + n = n (n+1)/2
B. Algorithm:

o Step 1. Start
o Step 2. Read number num
o Step 3. [Initialize]
sum=0, i=1
o Step 4. Repeat step 4 through 6 until i<=num
o Step 5. sum=sum+i
o Step 6. i=i+1
o Step 7. print the sum
o Step 8. Stop
C. Flow Chart:

11 | P a g e
D. Source code:

#include<stdio.h>
int main()
{
int n,sum;
printf("Enter nth number:");
scanf("%d",&n);
sum=(n*(n+1))/2;
printf("\nSummation 1 to nth number:%d\n",sum);
return 0;
}

12 | P a g e
E. Output:
6. Write a C program which display sum of square sums of first n natural
numbers.

A. Problem definition:
Given a positive integer n. The task is to find the sum of the sum of square of first n natural
number.
Example:
Input: n = 3
Output: 20
Sum of square of first natural number = 1
Sum of square of first two natural number = 1^2 + 2^2 = 5
Sum of square of first three natural number = 1^2 + 2^2 + 3^2 = 14
Sum of sum of square of first three natural number = 1 + 5 + 14 = 20
Input: n = 2
Output: 6
B. Algorithm:
o Step 1. Start
o Step 2. Read number num
o Step 3. [Initialize]
sum=0, i=1
o Step 4. Repeat step 4 through 6 until i<=num
o Step 5. sum=sum+(i*i)
o Step 6. i=i+1
o Step 7. print the sum of square
o Step 8. Stop

13 | P a g e
C. Flowchart:

D. Source code:
#include <stdio.h>
int main() {
int num, square, sum = 0, i = 1;
/* get the input value for n from user */
printf("Enter the value for n:");
scanf("%d", &num);
/* calculate the square of 1st n natural numbers */
while (i <= num) {

14 | P a g e
square = i * i;
sum = sum + square;
i++;
}
/* print the sum of square of first n natural nos */
printf("Sum of squares of first %d natural"
" numbers is %d\n", num, sum);
return 0;
}

E. Output:

7. Write a C program for cube sum of first n natural numbers.

A. Problem definition:
In this problem we will see how we can get the sum of cubes of first n natural numbers. Here we
are using one for loop, that runs from 1 to n. In each step we are calculating cube of the term and
then add it to the sum. This program takes O(n) time to complete. But if we want to solve this in
O (1) or constant time, we can use this series formula:

15 | P a g e
B. Algorithm:
o Step 1. Start
o Step 2. Read number num
o Step 3. [Initialize]
sum=0, i=1
o Step 4. Repeat step 4 through 6 until i<=num
o Step 5. sum=sum+(i*i*i)
o Step 6. i=i+1
o Step 7. print the sum of square
o Step 8. Stop
C. Flowchart:

16 | P a g e
D. Source code:

#include<stdio.h>
long cube_sum_n_natural(int n) {
long sum = 0;
int i;
for (i = 1; i <= n; i++) {
sum += i * i * i; //cube i and add it with sum
}
return sum;
}
main() {
int n;
printf("Enter value of n: ");
scanf("%d", &n);
printf("Result is: %ld", cube_sum_n_natural(n));
}
E. Output:

17 | P a g e
8. Write a C program of
multiplication Table Up to 10.

A. Problem definition:
In mathematics, a
multiplication table is a
mathematical table used to define a
multiplication operation for an
algebraic system. Here we will
develop different C program
for Multiplication table
using for loop, using while loop, using do-while loop, from 1 to 10 and from 1 to N.
B. Algorithm:
o Step 1: Start
o Step 2: Input num, the number for which multiplication table is to be printed.
o Step 3: For c = 1 to 10
o Step 4: Print res = num * c
o Step 5: End For loop
o Step6: Stop
C. Flowchart:

D. Source code:
#include <stdio.h>

18 | P a g e
int main()
{
int num, c,res;

printf("Enter an integer: ");


scanf("%d",&num);

for(c=1; c<=10; ++c)


{
res=num*c;
printf("%d * %d = %d \n", num, c, res);
}
return 0;}

E. Output:

19 | P a g e
9. Write a C program
to calculate the
factorial of a given
number.

A. Problem definition:
Factorial of a whole number
'n' is defined as the product
of that number with every
whole number till 1. For
example, the factorial of 4
is 4×3×2×1, which is equal
to 24. It is represented using the symbol '!'. In C program The first function needs to get the
number and pass it back to main, this value then needs to be passed into a second function that
calculates the factorial and passes that value back to main with the result being printed in the
third and final function.
B. Algorithm:
o step 1. Start
o step 2. Read the number n
o step 3. [Initialize]
i=1, fact=1
o step 4. Repeat step 4 through 6 until i=n
o step 5. fact=fact*i
o step 6. i=i+1
o step 7. Print fact
o step 8. Stop
C. Flowchart:

20 | P a g e
int n,i,fact=1; any number:");
printf("Enter
scanf("%d", &n);
for(i=1; i<=n; i++)
fact = fact * i;
printf("Factorial value of %d = %d",n,fact);
return 0;
}

21 | P a g e
E. Output:
10. Write a C program to find a year is Leap Year or not.

A. Problem definition:
A year that has 366 days is called a leap year. A year can be checked whether a year is leap year
or not by dividing the year by 4, 100 and 400. If a number is divisible by 4 but not by 100 then,
it is a leap year. Also, if a number is divisible by 4, 100 and 400 then it is a leap year.
Otherwise, the year is not a leap year.

B. Algorithm:

o Start
o Step 1 → Take integer variable year
o Step 2 → Assign value to the variable
o Step 3 → Check if year is divisible by 4 but not 100, DISPLAY "leap year"
o Step 4 → Check if year is divisible by 400, DISPLAY "leap year"
o Step 5 → Otherwise, DISPLAY "not leap year"
o Stop

22 | P a g e
C. Flowchart:

D. Source code:

#include <stdio.h>
int main()
{
int year;
/* Input year from user */
printf("Enter year : ");
scanf("%d", &year);
/* If year is exactly divisible by 4 and year is not divisible by 100
* or year is exactly divisible by 400 then
* the year is leap year.
* Else year is normal year
*/
if(((year % 4 == 0) && (year % 100 !=0)) || (year % 400==0))
{
printf("LEAP YEAR");
}

23 | P a g e
else
{
printf("COMMON YEAR");
}
return 0;
}
E. Output:

11. Write a C program to check whether a number is positive, negative or zero.

A. Problem definition:

The problem is to check whether a number is positive, negative or zero. Positive numbers are
those whose value are greater than zero, negative numbers value is less than zero.

24 | P a g e
B. Algorithm:
o Step 1: Start
o Step 2: [Input the value of n] read n
o Step 3: [determine whether the given value is positive, negative or zero]
If (n>0), write n as positive and go to step 4
Else, write n as negative and go to step 4
If (n=0), write n as zero and go to step 4
o Step 4: Stop

C. Flowchart:

D. Source code:

#include <stdio.h>
int main()

25 | P a g e
{
int num;
/* Input number from user */
printf("Enter any number: ");
scanf("%d", &num);
if(num > 0)
{
printf("Number is POSITIVE");
}
else if(num < 0)
{
printf("Number is NEGATIVE");
}
else
{
printf("Number is ZERO");
}
return 0;
}

E. Output:

12. Write a C program which finds the largest number from three numbers.

A. Problem Identification:
There are various methods to find the largest number. Like we can use the maximum function
of the programming language directly but the main thing here is understanding how we solve

26 | P a g e
any problem or what is the logic behind the problem and its time complexity. To solve this
problem, we can use only If statements or If and else or nested If and else or using Ternary
Operator. These are all of the same type comparing the numbers which each other. The only
difference is the way of writing. I will be using the Ternary operator as many of them don't use
it but is very useful as with few lines we can write the program.

C program to find largest of three given numbers is discussed here. Input three integers from the
user and find the largest number among them. Given three numbers num1, num2, and num3.
The task is to find the largest number among the three.

B. Algorithm:
o Step 1: start
o Step 2: declare variable a, b and c
o Step 3: read variable a, b and c
o Step 4: if a> b
a>c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b> c
Display b is the largest number
Else
Display c is the largest number
o Step 5: stop

27 | P a g e
C.

Flowchart:

D. Source code:
#include <stdio.h>
int main()
{
float n1, n2, n3;

printf("Enter three numbers: ");


scanf("%f %f %f", &n1, &n2, &n3);

if( n1>=n2 && n1>=n3)


printf("%f is the largest number.", n1);

else if (n2>=n1 && n2>=n3)


printf("%f is the largest number.", n2);
else
printf("%f is the largest number.", n3);

28 | P a g e
return 0;

}
E. Output:

13. Write a C Program Code to Calculate Average and Percentage Marks.

A. Problem definition:
To calculate a student's average and percentage marks in C programming, we must first enter
marks obtained in several subjects (5 subjects here, i.e., Physics, Chemistry, Math, CS, and
English). Percentage refers to a percentage (hundreds), which is a ratio of parts out of 100. The
percent symbol is percent. We usually count the percentage of marks obtained, the return on

29 | P a g e
Start

investment, and so on. Percentage can also be greater than 100 percent. Percentage is calculated
by dividing the total number of marksmarks,
Declare obtained
sum,byavg,
theperc
total number of marks obtained and
multiplying the result by 100.

B. Algorithm:
o Step 1: Start
o Step 2: Declare mark [5], Seti, sum=0, i=1 perc;
sum, avg,
o Step 3: Set sum=0
o Step 4: if i < 5 then
read mark[i]
update sum = sum + mark [i]
o Step 5: increment i by 1 i<s
o Step 6: if i<5 repeat step 5
o Step 7: calculate avg=sum/5;
perc=(sum/500) *100;
o Step 8: Show avg and perc value
o Step 9: End
Read marks

sum = sum + mark,


avg=sum/5;
perc=(sum/500) *100
i=i+1

Show avg, perc value

End
Flowchart:

30 | P a g e
No

Yes

Display Length

Source code:

#include<stdio.h>
int main()
{
int mark[5], i;

31 | P a g e
float sum=0,avg,perc;
printf("Enter marks obtained in Physics, Chemistry, Maths, CS, English :");
for(i=0; i<5; i++)
{
scanf("%d",&mark[i]);
sum=sum+mark[i];
}
avg=sum/5;
perc=(sum/500)*100;
printf("Average Marks = %f",avg);
printf("\nPercentage = %f%",perc);
return 0;}

Output:

32 | P a g e
14. Write a C program to calculate GPA from input marks.

Step 1 : start
Step 2 : read marks or Percentage
Step 3 : if marks >= 80 then grade =A, go to step 7
Step 4 : if marks >= 60 and marks <=80 then grade = B, go to step 7
Step 5 : if marks >=40 and marks <=60 then grade = C go to step 7
Step 6 : display failed
Step 7 : display grade.
Step 8 : stop.

Source code:

#include <stdio.h>

33 | P a g e
int main()
{
int marks;
printf("\n Enter marks:",marks);
scanf("%d",&marks);
if(marks>=90)
printf("\nGPA is A+\n");
else if(marks>=80)
printf(" GPA is A\n");
else if(marks>=70)
printf(" GPA is A-\n");
else if(marks>=60)
printf(" GPA is B+\n");
else if(marks>=50)
printf(" GPA is B\n");
else if(marks>=40)
printf(" GPA is C\n");
else printf("Result is FAIL");
return 0;
}

34 | P a g e
15. Write a C Program Code to Calculate Area and Circumference of Circle.
Principle

The area of a circle is the space occupied by the circle in a two-dimensional plane. The formula for the
area of a circle is pi*r*r and circumference is the any shape defines the path or the boundary that
surrounds the shape. Circumference (or) perimeter of a circle = 2*π*r

Algorithm to calculate Area and circumference of Circle

Step 1: Start

Step 2: Input r

Step 3: let pi = 3.14

Step 4: Area= pi*r*r

Step 5: Circumference= 2*pi*r

Step 6: Print area, circumference,

Step 7: Stop

Flowchart to calculate area and circumference of circle

35 | P a g e
Source Code:

#include<stdio.h>

#include<conio.h>

int main(void)

{ float r, area, circum;


printf("Enter the radius of the circle :");
scanf("%f",&r);
area=3.14*r*r;
circum=2*3.14*r;
printf("\nArea of the circle = %f\n\nCircumference of the circle = %f\n",area,circum);

Output:

16. Write a C Program which Convert s from Fahrenheit to Centigrade.

Problem identification

36 | P a g e
In this program, we will learn and get code about conversion of temperature value

from Fahrenheit to Celsius. Before going to the program, let's understand about its

formula used in conversion.

Fahrenheit to Celsius Formula: The Fahrenheit to Celsius Formula is:

celsius = (fahrenheit-32)*(100/180)

To learn more about this formula, then refer to Celsius to Fahrenheit Formula

explanation. There you will get a complete understanding about how this formula is

derived. We know that the title is for Celsius to Fahrenheit, but don't care about it,

you automatically understand about the Fahrenheit to Celsius formula after reading that

program.

The formula given above can also be written as:

celsius = (fahrenheit-32)/(180/100)

And as the value of 180/100 is 1.8, so the previous formula can be further written

as:

celsius = (fahrenheit-32)/1.8

37 | P a g e
Now let's move on to the program written in C for the conversion of Fahrenheit to

Celsius.

Algorithm:
Step 1: Read temperature in Fahrenheit,
Step 2: Calculate temperature with formula C=5/9*(F-32),
Step 3: Print C

Flowchart:

Source code:
int main()
{
float fah, cel;
printf("Enter temperature in Fahrenheit : ");
scanf("%f",&fah);
cel=(fah-32) / 1.8;
printf("Temperature in Celsius = %f",cel);
return 0;
}

38 | P a g e
17. Write a C program which computes the power of a number.

Problem Definition
The program below takes two integers from the user (a base number and an exponent) and
calculates the power.
For example:
In the case of 23
2 is the base number
3 is the exponent
And, the power is equal to 2*2*2 or 4*2

Algorithm:
Step 1: Start
Step 2: Declare variables x,y,n
Step 3 : Input x,n
Step 4 :  y=pow(x,n)
Step 5 : Print y

39 | P a g e
Step 6 : Stop

Flowchart:

Source code:
#include<stdio.h>
int main()
{
int x,y,n;

printf("Enter number:",x);
scanf("%d",&x);
printf("\nValue of power:",n);
scanf("%d",&n);

y=pow(x,n);
printf("\nResult is %d\n",y);

40 | P a g e
18. Write a C program which computes the square root and cubic root of a number
Problem Definition

This program will print Square and Cube Root of all Numbers from 1 to N using loop.

Here, we are reading value of N (limit) and will calculate, print the square, cube and square root
of all numbers from 1 to N.

To find square, we are using (i*i), cube, we are using (i*i*i) and square root, we are using sqrt(i).

Here, i is the loop counter and sqrt(i) is the function of math.h, which returns the square root of a
number.

41 | P a g e
Algorithm:
Step 1: Start
Step 2: Declare variables x,y,z
Step 3 : Input x
Step 4 :  y=sqrt(x) and z=cbrt(x)
Step 5 : Print y and print z
Step 6 : Stop

Flowchart:

Source code:

#include<stdio.h>
#include<math.h>
int main(void)
{
int x;
float y,z;
//int cubeRoot(x);

42 | P a g e
printf("Enter number:",x);
scanf("%d",&x);

y=sqrt(x);
printf("\nResult is %f\n",y);
z=cbrt(x);
printf("\nResult is %f\n\n",z);
}

19. Write a C program to swap two numbers.

43 | P a g e
problem identification:

Swapping is used in various programs like sorting the array. It is mainly used in the

area when we want to store old values without using much space.

in this C program to swap two numbers with and without using a third variable, using

pointers, functions (Call by reference) and using bit-wise XOR operators.

Swapping means interchanging. If the program has two variables a and b where a =

4 and b = 5, after swapping them, a = 5, b = 4. In the first C program, we use

a temporary variable to swap two numbers.

Algorithm (without using third variables)

STEP 1: START

STEP 2: ENTER A, B

STEP 3: PRINT A, B

STEP 4: A = A + B

STEP 5: B= A - B

STEP 6: A =A - B

STEP 7: PRINT A, B

STEP 8: END

44 | P a g e
Flowchart (without using third variables)

Source Code

#include <stdio.h>

int main()

int x, y, temp;

printf("Enter two integers\n");

scanf("%d%d", &x, &y);

printf("Before Swapping\nFirst integer = %d\nSecond integer = %d\n", x, y);

temp = x;

x = y;

y = temp;

printf("After Swapping\nFirst integer = %d\nSecond integer = %d\n", x, y);

return 0;

45 | P a g e
Output:

20. Write a C program to Print Fibonacci Series.

Principle:

The Fibonacci Sequence is the series of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

The next number is found adding up before two number of it.

Algorithm to print Fibonacci series


Step 1: Start
Step 2: Declare variable a, b, c, n, i
Step 3: Initialize variable a=0, b=1 and i=2
Step 4: Read n from user
Step 5: Print a and b
Step 6: Repeat until i<=n :
Step 6.1: c=a+b
Step 6.2: print c
Step 6.3: a=b, b=c
Step 6.4: i=i+1
Step 7: Stop.

46 | P a g e
Flowchart to print Fibonacci
series

Source Code:
#include <stdio.h>
int main()
{
int i, n, t1 = 0, t2 = 1, nextTerm;

printf("Enter the number of terms: ");


scanf("%d", &n);

printf("Fibonacci Series: ");

for (i = 1; i <= n; ++i)


{
printf("%d, ", t1);
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
}
return 0;
}.

Output

47 | P a g e
X=1
Start
Take n numbers
If x<n
21. Write a C program which Checks a number is Prime or Not.

Problem Statement:

Prime number logic: a number is prime if it is divisible only by one and itself. Remember two is
the only even and the smallest prime number. First few prime numbers are 2, 3, 5, 7, 11, 13,
17, .... Prime numbers have many applications in computer science and mathematics. A number
greater than one can be factorized into prime numbers, for example, 540 = 2 2*33*51. To check
whether the input number is a prime number or not a prime number in C programming, you have
to ask to the user to enter a number and start checking for prime number. If number is divisible
by 2 to one less than that number (i.e., n-1), then the number is not prime number, otherwise it
will be prime number.

B. Algorithm:

Step 1: Start

Step 2: Take nth number

Step 3: Set x=1

Step 4: if x<n, then x=x+1

Step 5: if n\x=1; Print “Number is Prime number”

Step 6: else

Print “Number is not prime number”

Step 7: Stop

C. Flowchart:

48 | P a g e
Stop
Print “Number x=x+1 Print “Number
is prime” is not prime”
If n\
x=1

D. Source Code:

Following C program ask the user to enter a number to check whether it is a prime number or
not, then display it on the screen:

#include<stdio.h>

int main()

{ int num,i,count=0;

printf("Enter a number:");

scanf("%d",&num);

for(i=2;i<num;i++)

49 | P a g e
{

if(num%i==0)

{ count++;

break;

} }

if(count==0)

printf("This is a prime number");

else

printf("This is not a prime number");

return 0;

Output:

50 | P a g e
22. Write C program which checks a patient is in diabetics or not.
Problem Definition
Diabetes is a chronic disease that occurs either when the pancreas does not produce enough
insulin or when the body cannot effectively use the insulin it produces. A blood sample will be
taken after an overnight fast. A fasting blood sugar level less than 100 mg/dL (5.6 mmol/L) is
normal. A fasting blood sugar level from 100 to 125 mg/dL (5.6 to 6.9 mmol/L) is considered
prediabetes. If it's 126 mg/dL (7 mmol/L) or higher on two separate tests, you have diabetes.
In oral glucose tolerance test a blood sugar level less than 140 mg/dL (7.8 mmol/L) is normal. A
reading of more than 200 mg/dL (11.1 mmol/L) after two hours indicates diabetes. A reading
between 140 and 199 mg/dL (7.8 mmol/L and 11.0 mmol/L) indicates prediabetes.

Algorithm
Step 1: Start
Step 2: Enter Blood glucose level
Step 3: Check if bg<= 6.5
Print patient is healthy
Step 4: Check if bg<=7.0
Print patient is in pre diabetics
Else Print patient is in diabetics
Step 5: Stop
Flowchart

51 | P a g e
Source Code
#include <stdio.h>
int main()
{
float bg;
printf("\n Enter blood glucose level:",bg);
scanf("%f",&bg);
if(bg<=6.5)
printf("\n Patient is healthy.\n");
else if(bg<=7.0)
printf("\n Patient is in pre-diabetics.\n");
else printf("\nPatient is in diabetics.\n");

52 | P a g e
return 0;
}

Output

23. Write a C program which mapping a patient has what type of disease.
Problem Definition
Disease is a particular quality or disposition regarded as adversely affecting a person or group of
people. Here we will see three phase of person. We indicate blood glucose as bg,low density
lipoprotein ldl, high density lipoprotein as hdl, low blood pressure as bpl, high blood pressure as
bph.

If anyone have bg<=6.5,ldl<=120, hdl<=20, bpl<=80, bph<=120 then the patient is healthy. Else
bg>=7.0 ldl<=180, hdl<=300, bpl<=90, bph<=130 patient is in pre-diabetics and pre-
hypertension. Else if Patient is in diabetics and severly heart disease.

B. Algorithm

Step 1: Start
Step2: Input blood glucose as bg,low density lipoprotein ldl, high density lipoprotein as hdl, low
blood pressure as bpl, high blood pressure as bph.
Step3: If anyone have bg<=6.5,ldl<=120, hdl<=20, bpl<=80, bph<=120 , Print the patient is
healthy.
Step 4: Else bg>=7.0 ldl<=180, hdl<=300, bpl<=90, bph<=130 print patient is in pre-diabetics
and pre-hypertension.

Step 5: Else if print Patient is in diabetics and severly heart disease.

C. Flowchart

53 | P a g e
D. Source Code

#include <stdio.h>

int main()

float bg,ldl,hdl,bpl,bph;

printf("\n Enter blood glucose level:");

scanf("%f",&bg);

printf("\n Enter LDL cholestrol level:");

scanf("%f",&ldl);

printf("\n Enter HDL cholestrol level:");

scanf("%f",&hdl);

printf("\n Enter BPL limit:");

scanf("%f",&bpl);

54 | P a g e
printf("\n Enter BPH limit:");

scanf("%f",&bph);

if(bg<=6.5&&ldl<=120&&hdl<=200&&bpl<=80&&bph<=120)

printf("\n Patient is healthy.\n");

else if(bg>=7.0&&ldl<=180&&hdl<=300&&bpl<=90&&bph<=130)

printf("\n Patient is in pre-diabetics and pre-hypertension\n");

else printf("\nPatient is in diabetics and severly heart disease.\n");

return 0;

E. Output 

55 | P a g e
24. write a C program to display characters from A to Z using loop.

A.Problem Definition:
In any programing language including C, loops are used to execute a set of statements repeatedly
until a particular condition in satisfied. In this program, the for loop is used to display the
English alphabet in uppercase. Here's a little modification of the above program.
The program displays the English alphabet in either uppercase or lowercase depending upon the
input given by the user. For example, Alphabets from A-Z are, A B C D F F G H I J K L M N O
P Q R S T U V W X Y Z.
B.Algorithm:
1. Start

2. Declare an integer type variable.

3. Assign it to the ASCII value of the first English alphabets.

4. Use this variable as the loop variable.

5. Iterate till the last element of the English alphabet.

6. Print the character corresponding to the ASCII value.

7. Stop.

C.Flowchart:

56 | P a g e
D.Source Code:
We will learn to display the English alphabets using for loop in this example.

#include <stdio.h>
int main()
{
char c
for(c = 'A'; c <= 'Z'; ++c)
printf("%c ", c);
printf("\n");

return 0;
}
E.Output
ABCDEFGHIJKLMNOPQRSTUVWXYZ

57 | P a g e
25. Write a C program which displays your name.

Algorithm:
Step 1: Start
Step 2: Declare the variable of your name
Step 3: Enter your name
Step 4: Print your name
Step 5: End
Flow chart:

Source code
#include<stdio.h>
int main()
{
char str[100];
printf("Enter your name:");

58 | P a g e
scanf("%s",str);
printf("\nMy name is %s\n",str);
return 0;
}

Output:

59 | P a g e
26. Write a C program to check whether a character is uppercase or lowercase
Problem statement:

As we all know, in the English language, there are a couple of cases of the alphabets. They are
known as Upper Case and Lower Case. This is how both of those look like:

As we can see, the left character is the Upper Case A and the right character is the Lower Case a.
This specific article deals with the C programs to distinguish between both of these.
Programming languages are case sensitive. It’s has taken an uppercase character and a lowercase
character separately. With C programming language we can easily identify whether a character is
uppercase or lowercase. the program displays whether the entered character is lowercase
alphabet or uppercase alphabet by checking its ASCII value. We know that the ASCII value of
lowercase alphabet ‘a’ is 97, ‘b’ is 98 … ‘z’ is 122. And the ASCII value of uppercase alphabet
‘A’ is 65, ‘B’ is 66 … ‘Z’ is 90. As for example ASCII code of letter ‘A’=65 and ‘a’=97.
However, the difference of ASCII code between letter ‘A’ and ‘a’ is 32. So, System takes these
letter separately because of uppercase and lowercase.

Algorithm:

Step1: Start the program


Step1: Input your character
Step3: check: if character is upper or lower or is not a letter
Step4: Print
Step5: End the program

60 | P a g e
Flowchart

Source Code:

61 | P a g e
/**
* C program to check whether a character is uppercase
* or lowercase using inbuilt library functions
*/

#include <stdio.h>
#include <ctype.h> /* Used for isupper() and islower() */

int main()
{
char ch;

/* Input character from user */


printf("Enter any character: ");
scanf("%c", &ch);

if(isupper(ch))
{
printf("'%c' is uppercase alphabet.", ch);
}
else if(islower(ch))
{
printf("'%c' is lowercase alphabet.", ch);
}
else
{
printf("'%c' is not an alphabet.", ch);
}

return 0;
}

Output

62 | P a g e
63 | P a g e
It’salphabet
It’s digit
Not alphabet and not a digit
Declarechthe
>=variables
'0'
ch >=Start
'A' &&
&&End ch <=
ch <= 'Z'
'9'

27. Check whether a character is an alphabet, digit or special character.

Problem definition:
A character is alphabet if it in between a-z or A-Z.
A character is digit if it is in between 0-9.
A character is special symbol character if it neither alphabet nor digit.
Algorithm:
Step 1: Start
Step 2: Declare the variables
Step 3: Enter the character
Step 4: Print the character
Step 5: Stop

Flow Chart:

True

False

True

False

Source Code:
64 | P a g e
#include <stdio.h>
main() {
char ch;
printf("Enter a character: ");
scanf("%c", &ch);
if((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))
printf("This is an alphabet");
else if(ch >= '0' && ch <= '9')
printf("This is a number");
else
printf("This is a special character");
}
Output:

65 | P a g e
28. Write a program in C to check whether a character is vowel or consonant.

Problem definition: There are 26 alphabets in our English language. Out of which, 21 are consonants
and five are vowels. The five vowels are A,E,I,O,U.

Algorithm:
o Step 1: Start
o Step 2: Declare character type variable ch
o Step 3: Read ch from User
o Step 4: // Checking both lower and upper case vowels.
IF (ch == 'a' || ch == 'A' ||
 ch == 'e' || ch == 'E' ||
 ch == 'i' || ch == 'I' ||
 ch == 'o' || ch == 'O' ||
 ch == 'u' || ch == 'U' )
Print "Vowel"
ELSE
Print "Consonant"
o Step 5: Stop

Flowchart:

66 | P a g e
Source code:

#include <stdio.h>

int main() {

char c;

int lowercase_vowel, uppercase_vowel;

printf("Enter an alphabet: ");

scanf("%c", &c);

// evaluates to 1 if variable c is a lowercase vowel

lowercase_vowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');

// evaluates to 1 if variable c is a uppercase vowel

uppercase_vowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');

// evaluates to 1 (true) if c is a vowel

if (lowercase_vowel || uppercase_vowel)

printf("%c is a vowel.", c);

67 | P a g e
else

printf("%c
is a
consonant.", c);

return 0;

Output:

29. Write a C program which converts Uppercase to Lowercase.

PROBLEM DEFINITION:
In C program, user would be asked to enter a String (it can be in complete uppercase or partial
uppercase) and then the program would convert it into a complete (all characters in lower case)
lower case string. The logic we have used in the following program is: All the upper-case
characters (A-Z) have ASCII value ranging from 65 to 90 and their corresponding lower-case
characters (a-z) have ASCII value 32 greater than them. For example ‘A ‘has a ASCII value 65
and ‘a ‘has a ASCII value 97 (65+32). Same applies for other characters.
ALGORITHM:

 Step 1: Declare char str[100], i;


 Step 2: Read str;
for i = 0 to 100 and increment i by 1
for each iteration {
if (str[i] greater than 'A'
and str[i] less than 'Z') (

68 | P a g e
str[i] = str[i] + 32;)
 Step 3: print(str);

FLOWCHART:

SOURCE CODE:
#include<stdio.h>

Int main()
{
char ch;
printf("Enter a character in uppercase : ");
scanf("%c",&ch);
ch=ch+32;
printf("character in lowercase = %c",ch);
return 0;
}

69 | P a g e
OUTPUT:

30. Write a C program to check whether a character is uppercase or lowercase

Problem Definition:
Programming languages are case sensitive. It’s has taken an uppercase character and a lowercase
character separately. In C programming language we can easily identify whether a character is
uppercase or lowercase by using a small program. A computer function depends on machine
language or binary code. Anything we input in computer first it converted to binary language and
then it functions as per instruction. Every character we input has an ASCII unique code that
exchange to binary code by the system. As for example ASCII code of letter ‘A’=65 and ‘a’=97.
However, the difference of ASCII code between letter ‘A’ and ‘a’ is 32. So, System takes these
letters separately because of uppercase and lowercase. So, in programming language we must
careful to use uppercase and lowercase character when use. A small C programming developed
below to identify uppercase and lowercase character.

#Algorithm:
Step1: Start the program
Step1: Input your character
Step3: check: if character is upper or lower or is not a letter
Step4: Print
Step5: End the program

70 | P a g e
Start

#Flowchart: Input Character

T
Ch>= ‘a’ &&
Ch<= ‘z’

T Ch<= ‘A’ Ch is in
lowercase

Ch is in
uppercase F

Invalid

End

71 | P a g e
Source Code:
/**
* C program to check whether a character is uppercase
* or lowercase using inbuilt library functions
*/

#include <stdio.h>
#include <ctype.h> /* Used for isupper() and islower() */

int main()
{
char ch;

/* Input character from user */


printf("Enter any character: ");
scanf("%c", &ch);

if(isupper(ch))
{
printf("'%c' is uppercase alphabet.", ch);
}
else if(islower(ch))
{
printf("'%c' is lowercase alphabet.", ch);
}
else
{
printf("'%c' is not an alphabet.", ch);
}

return 0;
}

Output:

72 | P a g e
31. Write a C program which reverses a string.

PROBLEM DEFINITION:

A program has to be written which will reverse a string.


ALGORITHM:

Step 1: Start
Step 2: Read the string from the user
Step 3: Calculate the length of the string
Step 4: Initialize rev = “ ” [empty string]
Step 5: Initialize i = length - 1
Step 6: Repeat until i>=0:
6.1: rev = rev + Character at position 'i' of the string
6.2: i = i – 1
Step 7: Print rev
Step 8: Stop

FLOWCHART:

SOURCE CODE:

#include <string.h>

#include <stdio.h>

int main()
73 | P a g e
{

   char arr[100];

   printf("Enter a string to reverse\n");

   gets(arr);

   strrev(arr);

   printf("Reverse of the string is \n%s\n", arr);

   return 0;}

output:

32. Write a C program to concatenate strings.

Problem definition: C program to concatenate two strings, for example, if the first string is "C
programming" and the second string is " language" (note space before language) then on
concatenating these two strings we get the string "C programming language." To concatenate
two strings we use strcat function of string.h, to concatenate without using library function see
another code below which uses pointers.

Algorithm:

Step 1: Start

Step 2: enter first string as a

Step 3: enter second string as b

74 | P a g e
Declare
Start a,b

Read a and b

Step 4: strcat (a,b) Display the string

Step Strcat
5: End(a,b)

Flowchart:

Display the string


obtained

End

Source code:

#include <stdio.h>

#include <string.h>

int main()

char a[1000], b[1000];

printf("Enter the first string\n");

gets(a);

printf("Enter the second string\n");

75 | P a g e
gets(b);

strcat(a, b);

printf("String obtained on concatenation: %s\n", a);

return 0;

Output:

33. Write a C Program to Find the Length of a String

Problem definition:
The total number of characters in a string is referred to as its length. We can easily identify total
string by using the C programming language. The strlen() function in C is the best way to
determine the length of a string. However, using the following C program, we will manually
determine the length of a string.

Algorithm:

Step 1: Start
Step 2: Declare A [L…U], l, i
Step 3: Set l=0
Step 4: Reading string is A

76 | P a g e
Length= number*length
Start
Stop
Display
Read Length
number

Step 5: While A[l] ≠ Null


Increment l {l=l+1}
Step 6: End while
Step 7: Print 1
Step 8: Stop
Flowchart:

Source code:

#include <stdio.h>
#include <string.h>

77 | P a g e
int main ()
{
char a [100];
int length;
printf("Enter a string\n");
gets(a);
length = strlen(a);
printf("Length of the string = %d\n", length);
return 0;
}
Output:

34. C Program to Read a Line from a File and Display it.

Problem definition:
For reading a line from a file in C programming we should have the knowledge of the following
C programming topics:

78 | P a g e
C File Handling: A file is a container in computer storage in this tutorial, we will learn about file
handling in C. We will learn to handle standard I/O in C using fprintf(), fscanf(), fread(),
fwrite(), fseek() etc. with the help of examples.A file is a container in computer storage devices
used for storing data.e devices used for storing data.
C Programming Strings: We'll learn about strings in C programming. We'll learn to declare them,
initialize them and use them for various I/O operations with the help of examples.In C
programming, a string is a sequence of characters terminated with a null character \0.

Algorithm:

o Step 1: Start
o Step 2: Declare *Fptr as File
o Step 3: Declare C as character
o Step 4: Opening an Existing file go to step 5
o Step 5: Print “hi my name is C” go to step 6
o Step 6: Exit
o Step 7: Reading from file (fscanf)
o Step 8: Print Data from the file
o Step 9: Closing file (fclose)
o Step 10: End
Flowchart:
Flow chart:

START

Declare *Fptr as File

Declare C as character

fopen(Fptr)

Printf(“hi my name is c”)

Read fscan

Display data from Fptr

fclose(Fptr)

END

Source Code:

79 | P a g e
#include <stdio.h>
//#include,stdio.h>
#include <stdlib.h> // For exit() function
int main()
{
char c[1000];
FILE *fptr;
if ((fptr = fopen("program.txt", "r")) == NULL)
{
printf("Error! opening file");
// Program exits if file pointer returns NULL.
exit(1);
}
// reads text until newline
fscanf(fptr,"%[^\n]", c);
printf("\nData from the file:\n%s\n\n", c);
fclose(fptr);
return 0;
}
Output:

80 | P a g e
Lab Report 3: Database Management System

81 | P a g e
1. Hospital Information system

Problem definition

A hospital information system (HIS) is an element of health informatics that focuses mainly on


the administrational needs of hospitals. In other words, it is a computer system that can manage
all their formation to allow health care providers to do their jobs effectively.

 In many implementations, a HIS is a comprehensive, integrated information system designed


to manage all the aspects of a hospital's operation, such as medical, administrative, financial,
and legal issues and the corresponding processing of services.

Potential benefits of hospital information systems include: Efficient and accurate


administration of finance, diet of patient, engineering, and distribution of medical aid. It helps to
view a broad picture of hospital growth. Improved monitoring of drug usage, and study of
effectiveness.

Entity of HIS as follows:

In HIS we described four entities and each entity has several attributes as follows:

Patient (pat_tid, pname, paddress, pdiagnosis)

Hospital (hosp_id, hos_name, haddress, hcity)

doctor (doc_ id, dname, qualification, salary)

medicalrecord (record-id, problem, date_of_examination)

To draw a ER diagram for HIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

ER Diagram of HIS:

82 | P a g e
INCLUDEPICTURE "http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET

Figure: ER Diagram of HIS

83 | P a g e
Database design and development:
SQL query to form HIS database:

create database hims;

mysql> use hims;

Database changed

create table patient(pat_id int not null auto_increment,pname varchar(50),paddress


varchar(100),pdiagnosis varchar(50),record_id int(5),hosp_id int(5), primary key(pat_id));

insert into patient(pat_id,pname,paddress,pdiagnosis,record_id,hosp_id)


values(3001,'pinky','savar','hbs_AG',1001,2001);

create table hospital(hosp_id int not null auto_increment,hos_name varchar(50),haddress


varchar(100),hcity varchar(20),pat_id int(6),doc_id int(6),primary key(hosp_id));

insert into hospital(hosp_id,hos_name,haddress,hcity,pat_id,doc_id)

values(1001,'Prescription Point','Gulshan', 'Dhaka', 3001,4001);

create table doctor(doc_id int not null auto_increment,dname varchar(50),qualification


varchar(40),salary int(6),hosp_id int(5),primary key(doc_id));

insert into doctor(doc_id,dname,qualification,salary,hosp_id)

values(4001,'dr.Mahfuz','MBBS,MPH',60000,4001);

create table medicalrecord(record_id int not null auto_increment,problem


varchar(50),date_of_diagnosis varchar(20),pat_id int(6),primary key(record_id));

insert into medicalrecord(record_id,problem,date_of_diagnosis,pat_id)

values(2001,'hbs_AG','06-03-2019',3001);

84 | P a g e
Results and Discussion:
select pname from patient where pdiagnosis='hbs_AG';

+-------+

| pname |
85 | P a g e
+-------+

| pinky |

+-------+

select pname from patient where pdiagnosis='heart problem';

+-------+

| pname |

+-------+

| mesbah |

+-------+

mysql> select* from hospital;

+---------+--------------------+-----------+-------+--------+--------+

| hosp_id | hos_name | haddress | hcity | pat_id | doc_id |

+---------+--------------------+-----------+-------+--------+--------+

| 1001 | Prescription Point | Gulshan | Dhaka | 3001 | 4001 |

| 1002 | Apollo | Baridhara | Dhaka | 3002 | 4002 |

+---------+--------------------+-----------+-------+--------+--------+

select dname ,hos_name from doctor,hospital where doctor.hosp_id=hospital

.hosp_id;

+-----------+--------------------+

| dname | hos_name |

+-----------+--------------------+

| dr.Mahfuz | Prescription Point |

| dr.Zorich | Apollo |

86 | P a g e
select dname from doctor,hospital where doctor.hosp_id=hospital.hosp_id and
hos_name='Apollo';

+-----------+

| dname |

+-----------+

| dr.Zorich |

+-----------+

mysql> select hos_name from doctor,hospital where doctor.hosp_id=hospital.hosp_i

d and dname='dr.Mahfuz';

+--------------------+

| hos_name |

+--------------------+

| Prescription Point |

+--------------------+

87 | P a g e
88 | P a g e
89 | P a g e
2. Student information management system

Problem definition:
A student information management system is a management information system for education
establishments to manage student data. Student information systems provide capabilities for registering
students in courses; documenting grading, transcripts, results of student tests and
other assessment scores; building student schedules; tracking student attendance; and managing many
other student-related data needs in a school.

Information security is a concern, as universities house an array of sensitive personal


information, making them potentially attractive targets for security breaches, such as those
experienced by retail corporations or healthcare providers.
Entities of student information management system :

In SIMS we described four entities and each entity has several attributes as follows:

90 | P a g e
admin (aid, name, loginname, password)

course (cid, cname, fees, duration)

Student (sid, name, course, educationdetail, personaldetail, feesdetail)

teacher (tid, tname, course, education)

To draw a ER diagram for SMS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.

ER Diagram of student management system:

Figure: ER diagram of SMS

91 | P a g e
Database design and development:
SQL query to form SMS database:

create database sms;

Use sms;

Mysql>database changed

create table admin(aid int not null auto_increment,name varchar(50),login varchar(10),password


varchar(8),cid int(6),primary key(aid));

insert into admin(aid,name,login,password,cid)

values(1001,'mr.chein','chein','chein123',2001);

create table course(cid int not null auto_increment,cname varchar(40),fees int(5),duration


varchar(10),tid int(6),sid int(6),primary key(cid));

insert into course(cid,cname,fees,duration,tid,sid)

values(2001,’SPSS’,2000,'6month',3001,4001);

create table teacher(tid int not null auto_increment,name varchar(40),course


varchar(40),education varchar(30),cid int(6),primary key(tid));

mysql> desc teacher;

+-----------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+-----------+-------------+------+-----+---------+----------------+

| tid | int(11) | NO | PRI | NULL | auto_increment |

| name | varchar(40) | YES | | NULL | |

| course | varchar(40) | YES | | NULL | |

| education | varchar(30) | YES | | NULL | |

| cid | int(6) | YES | | NULL | |

+-----------+-------------+------+-----+---------+----------------+

92 | P a g e
insert into teacher(tid,name,course,education,cid)

values(3001,'dr.shamim','SPSS','PhD',2001);

mysql> create table student(sid int not null auto_increment,name varchar(40),course


varchar(30),educationdetail varchar(40),personaldetail varchar(50),feesdetail varchar(50),cid
int(6),primary key(sid));

insert into student(sid,name,course,educationdetail,personaldetail,feesdetail,cid)

values(4001,'Zenith','SPSS','B.Sc','Dhaka','paid’,2001);

Results and Discussion:


mysql> select* from teacher;

+------+-----------+--------+-----------+------+

| tid | name | course | education | cid |

+------+-----------+--------+-----------+------+

| 3001 | dr.shamim | SPSS | PhD | 2001 |

+------+-----------+--------+-----------+------+

93 | P a g e
94 | P a g e
mysql> select name from course,teacher where teacher.cid=course.cid and course='SPSS';

+-----------+

| name |

95 | P a g e
+-----------+

| dr.shamim |

+-----------+

mysql> select name from course,student where student.cid=course.cid and course='

SPSS';

+--------+

| name |

+--------+

| Zenith |

+--------+

96 | P a g e
mysql> select fees from course where cname='SPSS';

+------+

| fees |

+------+

| 2000 |

+------+

97 | P a g e
mysql> select name from admin,course where admin.cid=course.cid and cname='SPSS';

+----------+

| name |

+----------+

| mr.chein |

+----------+

98 | P a g e
3. Laboratory information management system

Problem definition:
A laboratory information management system (LIMS), sometimes referred to as a laboratory
information system (LIS) or laboratory management system (LMS), is a software-based solution
with features that support a modern laboratory's operations. Key features include—but are not
limited to—workflow and data tracking support, flexible architecture, and data exchange
interfaces, which fully "support its use in regulated environments". The features and uses of a
LIMS have evolved over the years from simple sample tracking to an enterprise resource
planning tool that manages multiple aspects of laboratory informatics.

Entities of Laboratory Information Management System:


In LIMS we described four entities and each entity has several attributes as follows:

lab (lab_id, name, ph.no, address, tests, labtimings)

patient (p_id, name, address, gender, age, ph_no)

labmember (mem_id, type)

bill (billno, testcharge, deliverycharges)

99 | P a g e
To draw a ER diagram for LIMS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.

ER Diagram of LIMS:

Figure: ER diagram of LMS

Database design and development:


SQL query to form LIMS database:

create database lms;

mysql> use lms;

100 | P a g e
Database changed

mysql> create table lab(lab_id int not null auto_increment,name varchar(40),ph_no


int(13),address varchar(50),tests varchar(30),labtimings varchar(10),p_id int(6),primary
key(lab_id));

insert into lab(lab_id,name,ph_no,address,tests,labtimings,p_id)

values(1001,'pathology',027710004,'Dhaka','blood sugar','10amto8pm',4001);

create table patient(p_id int not null auto_increment,name varchar(40),address


varchar(50),gender varchar(6),age int(4),ph_no int(13),billno int(6),mem_id int(6),primary
key(p_id));

insert into patient(p_id,name,address,gender,age,ph_no,billno,mem_id)

values(4001,'mr.zorich','dhaka','male',38,027786907,3001,2001);

create table labmember(mem_id int not null auto_increment,type varchar(20),p_id int(6),primary


key(mem_id));

insert into labmember(mem_id,type,p_id)

values(2001,'pharmacist',4001);

create table bill(billno int not null auto_increment,testcharge int(8),deliverycharges int(8),p_id


int(6),primary key(billno));

insert into bill(billno,testcharge,deliverycharges,p_id)

values(3001,3500,500,4001);

101 | P a g e
Results and discussion:
mysql> select* from bill;

+--------+------------+-----------------+------+

| billno | testcharge | deliverycharges | p_id |

+--------+------------+-----------------+------+

| 3001 | 3500 | 500 | 4001 |

+--------+------------+-----------------+------+

102 | P a g e
103 | P a g e
mysql> select name,testcharge from lab,bill;

+-----------+------------+

| name | testcharge |

+-----------+------------+

104 | P a g e
| pathology | 3500 |

+-----------+------------+

mysql> select testcharge from lab,bill where name='pathology';

+------------+

| testcharge |

+------------+

| 3500 |

+------------+

105 | P a g e
mysql> select name from patient,bill where patient.p_id=bill.p_id and testcharge

=3500;

+-----------+

| name |

+-----------+

| mr.zorich |+-----------+

106 | P a g e
4. Pharmacy Information System

Problem definition
A pharmacy information system (PIS) is a system that has many different functions in order to
maintain the supply and organization of drugs. It can be a separate system for pharmacy usage
only, or it can be coordinated with an inpatient hospital computer physician order entry (CPOE)
system. A PIS paired with a CPOE allows for an easier transfer of information.
A PIS is used to reduce medication errors, increase patient safety, report drug usage, and track
costs. Inpatient pharmacy information systems are used in the hospital setting while outpatient
pharmacy information systems are used in home settings for discharged patients, clinics, long-
term care facilities, and home health care. Most of the uses and capabilities of the PIS are similar
for inpatient and outpatient settings. However, the outpatient PIS has a stronger emphasis on
medication labeling, drug warnings, and instructions for administration.
Historically, the societal purpose of pharmacy has been to make drugs and medicines available.
While this core function of pharmacy remains unchanged, the profession's purpose has evolved
with new medical and pharmaceutical knowledge and technological advancements.
Entity of PIS as follows:
In PIS we described five entities and each entity has several attributes as follows:

admin (id,user_id,mobile,status,password)

supplier (id,user_id,mobile,status,password)

107 | P a g e
product(pro_id,pro_author,pro_details,pro_baseprice,pro_buyer,pro_soldprice,pro_status)

buyer(buyer_id,mobile,status,password)

bid_product(bid_pro_id,bid_buyer_name,bid_price,status)

To draw a ER diagram for PIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.

ER Diagram of PIS:

108 | P a g e
ER-Diagram of pharmacy information system

Database design and development:


Create database pims;

Use pims;

create table admin(admin_id int not null auto_increment,mobile int(13),status


varchar(10),password varchar(10),sid int(10),buyer_id int(10),primary key(admin_id));

insert into admin(admin_id,mobile,status,password,sid,buyer_id)

values(1001,01912345678,'in-servics','drasad',2001,3001);

create table supplier(sid int not null auto_increment,status varchar(20),

password varchar(10),admin_id int(10),pro_id int(10),primary key(sid));

insert into supplier(sid,status,password,admin_id,pro_id)

values(2001,'active','aksixteen',1001,4001);

create table buyer(buyer_id int not null auto_increment,mobile int(13),status


varchar(20),password varchar(10),bid_product_id int(10),admin_id int(10),primary
key(buyer_id));

insert into buyer(buyer_id,mobile,status,password,bid_product_id,admin_id)

values(3001,011234567,'login','fifteen',5001,1001);

create table product(pro_id int not null auto_increment,pro_autor varchar(20),pro_details


varchar(40),pro_baseprice int(10),pro_soldprice int(10),pro_status varchar(20),sid
int(10),primary key(pro_id));

insert into product(pro_id,pro_autor,pro_details,pro_baseprice,pro_soldprice,pro_status,sid)

values(4001,'square','injection',340,310,'qc passed',2001);

109 | P a g e
create table bid_product(bid_product_id int not null auto_increment,bid_buyer_name
varchar(40),bid_price int(10),status varchar(20),buyer_id int(10),primary key(bid_product_id));

insert into bid_product(bid_product_id,bid_buyer_name,bid_price,status,buyer_id)

values(5001,'dr.mahfuz',1100,'good',3001);

Results and Discussion:


select * from buyer;

+----------+----------+--------+----------+----------------+----------+

| buyer_id | mobile | status | password | bid_product_id | admin_id |

+----------+----------+--------+----------+----------------+----------+

| 3001 | 11234567 | login | fifteen | 5001 | 1001 |

+----------+----------+--------+----------+----------------+----------+

110 | P a g e
111 | P a g e
112 | P a g e
select pro_autor from product,supplier where product.pro_id=supplier.pro_id and
admin_id=1001;

+-----------+

| pro_autor |

+-----------+

| square |

+-----------+

113 | P a g e
select pro_details,pro_baseprice from product;

+-------------+---------------+

| pro_details | pro_baseprice |

+-------------+---------------+

| injection | 340 |

+-------------+---------------+

114 | P a g e
select pro_baseprice from product where pro_soldprice=310;

+---------------+

| pro_baseprice |

+---------------+

| 340 |

115 | P a g e
mysql> select pro_details from product where pro_soldprice=310;

+-------------+

| pro_details |

+-------------+

| injection |

+-------------+

116 | P a g e
mysql> select bid_buyer_name from bid_product,buyer where buyer.buyer_id=bid_pro

duct.buyer_id;

+----------------+

| bid_buyer_name |

+----------------+

| dr.mahfuz |

+----------------+

117 | P a g e
5. Emergency Department Information System

Problem definition
The purpose of the emergency room is to treat critically ill patients and to prevent cardiac arrest
in patients presenting with signs of physiological instability.

Health uses the Emergency Department Information System (EDIS) to assist in the management
of emergency departments. This system is both a workflow and a data collection tool designed to
capture real-time information about patients, and to support the operational control of Health
emergency departments. EDIS is used when a patient presents to an emergency department to
capture key information including:

 patient identity (unique identifier generated or existing in the system) such as date of
birth, address, occupation, next of kin
 insurance status (Medicare or Private)
 admission time
 mode of arrival (e.g. ambulance, private transport)
 treating medical professional (e.g. doctor or nurse)
 primary diagnosis
 outcome (i.e. admitted to hospital or discharged)
 discharge and departure date
118 | P a g e
Data from EDIS is used for emergency department (ED) performance and management
reporting. This includes:

 achievement of Activity Service Targets for ED attendances


 percentage of ED patients admitted, transferred or discharged within four hours
 percentage of unplanned re-attendances within 48 hours

Entity of EDIS as follows:


In EDIS we described six entities and each entity has several attributes as follows:

patient(pat_id,name,gender,age,notes)

registration (reg_no,date,assurance)

doctor (doc_id,name,gender,age,specialist)

medicalrecord(mr_no,date,diagnos,drugs,reference)

administration (admin_id,endorsem,letter_no)

healthoffice (rec_id,rec_name)

To draw a ER diagram for PIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.

ER Diagram of EDIS:

119 | P a g e
Figure: ER-diagram of emergency department information system

Database design and development:


mysql> use edims;

Database changed

create table patient(pat_id int not null auto_increment,name varchar(20),gender varchar(6),age


int (5),notes varchar(40),doc_id int(10),reg_no int(10),primary key(pat_id));

insert into patient(pat_id,name,gender,age,notes,doc_id,reg_no)

values(3001,'abir','male',12,'he is week',4001,5001);

create table registration(reg_no int not null auto_increment,date varchar(20),assurance


varchar(20),pat_id int(10),primary key(reg_no));

120 | P a g e
insert into registration(reg_no,date,assurance,pat_id)

values(5001,'01-03-2019','quality treatment',3001);

create table doctor(doc_id int not null auto_increment,name varchar(20),gender varchar(6),age


int(10),specialist varchar(30),pat_id int(10),mr_no int(10),primary key(doc_id));

insert into doctor(doc_id,name,gender,age,specialist,pat_id,mr_no)

values(4001,'dr.mahfuz','male','40','dentist',3001,6001);

create table medicalrecord(mr_no int not null auto_increment,date varchar (20),diagnos


varchar(20),drugs varchar(20),reference varchar(40),doc_id int(10),admin_id int(10),primary
key(mr_no));

insert into medicalrecord(mr_no,date,diagnos,drugs,reference,doc_id,admin_id)

values(6001,'11-03-2019','blood-glucose','insulin','avoid sugar',4001,1001);

create table administration(admin_id int not null auto_increment,endorsem varchar(10), letter_no


varchar(20),mr_no int(10),rec_id int(10),primary key(admin_id));

insert into administration(admin_id,endorsem,letter_no,mr_no,rec_id)

values(1001,'yes','a/223/2019',6001,2001);

create table healthoffice(rec_id int not null auto_increment,rec_name varchar(40), admin_id


int(10),primary key(rec_id));

insert into healthoffice(rec_id,rec_name,admin_id)

values(2001,'mr.rubayet',1001);

121 | P a g e
122 | P a g e
Results and Discussion:

mysql> select * from registration;

+--------+------------+-------------------+--------+

| reg_no | date | assurance | pat_id |

+--------+------------+-------------------+--------+

| 5001 | 01-03-2019 | quality treatment | 3001 |

+--------+------------+-------------------+--------+

123 | P a g e
124 | P a g e
125 | P a g e
select diagnos from medicalrecord,doctor where doctor.mr_no=medicalrecord.mr_no and
name='dr.mahfuz';

+---------------+

| diagnos |

+---------------+

| blood-glucose |

+---------------+

126 | P a g e
select name from patient,registration where patient.pat_id=registration.pat_id and date='01-03-
2019';

+------+

| name |

+------+

| abir |

+------+

127 | P a g e
select rec_name from healthoffice,administration where administration.adm

in_id=healthoffice.admin_id and mr_no='6001';

+------------+

| rec_name |

+------------+

| mr.rubayet |

+------------+

128 | P a g e
select name,specialist from doctor;

+-----------+------------+

| name | specialist |

+-----------+------------+

| dr.mahfuz | dentist |

+-----------+------------+

129 | P a g e
mysql> select name,specialist from doctor where name='dr.mahfuz';

+-----------+------------+

| name | specialist |

+-----------+------------+

| dr.mahfuz | dentist |

+-----------+------------+

130 | P a g e
6. Nursing Information System

Problem definition
Nursing Information System (NIS) is a part of a health care information system that deals with
nursing aspects, particularly the maintenance of the nursing record. Nursing informatics (NI) is
the specialty that integrates nursing science with multiple information management and
analytical sciences to identify, define, manage, and communicate data, information, knowledge,
and wisdom in nursing practice. NI supports nurses, consumers, patients, the interprofessional
healthcare team, and other stakeholders in their decision-making in all roles and settings to
achieve desired outcomes. This support is accomplished through the use of information
structures, information processes, and information technology. The several objectives that a
Nursing Information system should meet in order to succeed its aims, cover the users' needs and
operate properly are described. The functions of such systems, which combine with the basic
tasks of the nursing care process, are examined. 

Entities of Nursing Information System:


In NIS we described four entities and each entity has several attributes as follows:

admin (admin_id,admin_name)

nurse (nurse_id,nurse_name,services,ward_no)

131 | P a g e
patient (pat_id, pat_name,age,contact,gender,disease,address)

drugs (drugs_id,drug_name)

stocks (stock_id,drugs_id,quantity)

To draw a ER diagram for LIMS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.

ER Diagram of NIMS:

Figure: ER diagram of NIMS

132 | P a g e
Database design and development:

mysql> create database nims;

mysql> use nims;

Database changed

create table admin(admin_id int not null auto_increment,admin_name varchar(20), nurse_id


int(10),primary key(admin_id));

create table nurse(nurse_id int not null auto_increment,nurse_name varchar(20),services


varchar(30),ward_no int(10),admin_id int(10),pat_id int(10),drugs_id int(10),primary
key(nurse_id));

create table patient(pat_id int not null auto_increment,pat_name varchar(20),age int(10),contact


int(10),gender varchar(6),disease varchar(20),address varchar(50), nurse_id int(10),primary
key(pat_id));

create table drugs(drugs_id int not null auto_increment,drugs_name varchar(30),nurse_id


int(10),stock_id int(10),primary key(drugs_id));

create table stocks(stock_id int not null auto_increment,drugs_id int(10),quantity int(10),primary


key(stock_id));

mysql> use nims;

Database changed

mysql> show tables;

+----------------+

| Tables_in_nims |

+----------------+

| admin |

| drugs |

| nurse |

| patient |
133 | P a g e
| stocks |

+----------------+

5 rows in set (0.01 sec)

mysql> desc admin;

+------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------+-------------+------+-----+---------+----------------+

| admin_id | int(11) | NO | PRI | NULL | auto_increment |

| admin_name | varchar(20) | YES | | NULL | |

| nurse_id | int(10) | YES | | NULL | |

+------------+-------------+------+-----+---------+----------------+

3 rows in set (0.05 sec)

insert into admin(admin_id,admin_name,nurse_id)

values(1001,'mr.patrick',2001);

desc nurse;

+------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------+-------------+------+-----+---------+----------------+

| nurse_id | int(11) | NO | PRI | NULL | auto_increment |

| nurse_name | varchar(20) | YES | | NULL | |

| services | varchar(30) | YES | | NULL | |

| ward_no | int(10) | YES | | NULL | |

| admin_id | int(10) | YES | | NULL | |

134 | P a g e
| pat_id | int(10) | YES | | NULL | |

| drugs_id | int(10) | YES | | NULL | |

+------------+-------------+------+-----+---------+----------------+

insert into nurse(nurse_id,nurse_name,services,ward_no,admin_id,pat_id,drugs_id)

values(2001,'mst zerin','heart section',1,1001,3001,4001);

desc patient;

+----------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+----------+-------------+------+-----+---------+----------------+

| pat_id | int(11) | NO | PRI | NULL | auto_increment |

| pat_name | varchar(20) | YES | | NULL | |

| age | int(10) | YES | | NULL | |

| contact | int(10) | YES | | NULL | |

| gender | varchar(6) | YES | | NULL | |

| disease | varchar(20) | YES | | NULL | |

| address | varchar(50) | YES | | NULL | |

| nurse_id | int(10) | YES | | NULL | |

+----------+-------------+------+-----+---------+----------------+

insert into patient(pat_id,pat_name,age,contact,gender,disease,address,nurse_id)

values(3001,'abir',12,01914134405,'male','fever','savar,dhaka',2001);

desc drugs;

+------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------+-------------+------+-----+---------+----------------+

135 | P a g e
| drugs_id | int(11) | NO | PRI | NULL | auto_increment |

| drugs_name | varchar(30) | YES | | NULL | |

| nurse_id | int(10) | YES | | NULL | |

| stock_id | int(10) | YES | | NULL | |

+------------+-------------+------+-----+---------+----------------+

insert into drugs(drugs_id,drugs_name,nurse_id,stock_id)

values(4001,'aspirin',2001,5001);

desc stocks;

+----------+---------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+----------+---------+------+-----+---------+----------------+

| stock_id | int(11) | NO | PRI | NULL | auto_increment |

| drugs_id | int(10) | YES | | NULL | |

| quantity | int(10) | YES | | NULL | |

+----------+---------+------+-----+---------+----------------+

insert into stocks(stock_id,drugs_id,quantity)

values(5001,4001,4000);

Results and Discussion:


mysql> select* from drugs;

+----------+------------+----------+----------+

| drugs_id | drugs_name | nurse_id | stock_id |

+----------+------------+----------+----------+

| 4001 | aspirin | 2001 | 5001 |

+----------+------------+----------+----------+

136 | P a g e
select pat_name from patient,nurse where patient.nurse_id=nurse.nurse_id and nurse_name='mst
zerin';

+----------+

| pat_name |

+----------+

| abir |

+----------+

select nurse_name from patient,nurse where patient.nurse_id=nurse.nurse_id and at_name='abir';

+------------+

| nurse_name |

+------------+

| mst zerin |

+------------+

select drugs_name from drugs,stocks where drugs.drugs_id=stocks.drugs_id

and quantity=4000;

+------------+

| drugs_name |

+------------+

| aspirin |

+------------+

mysql> select quantity from drugs,stocks where drugs.drugs_id=stocks.drugs_id an

d drugs_name='aspirin';

+----------+

| quantity |

+----------+

137 | P a g e
| 4000 |

+----------+

7. Clinical Information management system


Problem definition
A clinical information system (CIS) is an information system designed specifically for use in the critical
care environment, such as in an Intensive Care Unit (ICU). It can network with the many computer
systems in a modern hospital, such as pathology and radiology. It draws information from all these
systems into an electronic patient record, which clinicians can see at the patient’s bedside. In ICUs,
many medical devices are used to continually monitor extremely sick patients. Vast amounts of
information are produced. This information allows clinicians to make the right decisions. Without a CIS,
clinicians must collect most of these measurements and record them on paper-based 24-hour ‘ICU flow
charts’. With a CIS, all such measurements can be captured, recorded and collated electronically. This
reduces the need for many different paper-based forms, saves time and reduces the risk of error.

Entity of CIMS as follows:


In CIMS we described three entities and each entity has several attributes as follows:

Patient (pat_tid, pname, insurance,date_shifted,date_checked_out)

doctor (doc_ id, dname, specialization)

test (test_id,test_name,date,time,result)

To draw a ER diagram for CIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).

Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.

ER Diagram of CIMS:

138 | P a g e
Figure: ER Diagram of CIS

Database design and development:


SQL query to form CIMS database:

mysql> create database cims;

mysql> use cims;

Database changed

create table doctor(doc_id int not null auto_increment,dname varchar(20),specialization


varchar(30),pat_id int(10),test_id int(10),primary key(doc_id));

insert into doctor(doc_id,dname,specialization,pat_id,test_id)

values(1001,'dr.mahfuz','Dentist',2001,3001);

create table patient(pat_id int not null auto_increment,pname varchar(30),insurance


varchar(20),date_shifted varchar(15),date_checked_out varchar(15),doc_id int(10),test_id
int(10),primary key(pat_id));

insert into patient(pat_id,pname,insurance,date_shifted,date_checked_out,doc_id,test_id)

values(2001,'Abir','Life insurance','05-03-2019','12-03-2019',1001,3001);

139 | P a g e
create table test(test_id int not null auto_increment,test_name varchar(20),date varchar(15),time
varchar(15),result varchar(30),doc_id int(10),pat_id int(10),primary key(test_id));

insert into test(test_id,test_name,date,time,result,doc_id,pat_id)

values(3001,'hbs-ag','5-03-2019','9:00 am','negative',1001,2001);

Results and Discussion:


mysql> use cims;

Database changed

mysql> show tables;

+----------------+

| Tables_in_cims |

+----------------+

| doctor |

| patient |

| test |

+----------------+

140 | P a g e
select* from doctor;

+--------+-----------+----------------+--------+---------+

| doc_id | dname | specialization | pat_id | test_id |

+--------+-----------+----------------+--------+---------+

| 1001 | dr.mahfuz | Dentist | 2001 | 3001 |

+--------+-----------+----------------+--------+---------+

select* from test;

+---------+-----------+-----------+---------+----------+--------+--------+

| test_id | test_name | date | time | result | doc_id | pat_id |

+---------+-----------+-----------+---------+----------+--------+--------+

| 3001 | hbs-ag | 5-03-2019 | 9:00 am | negative | 1001 | 2001 |

+---------+-----------+-----------+---------+----------+--------+--------+

141 | P a g e
select pname from patient,doctor where patient.pat_id=doctor.pat_id and dname='dr.mahfuz';

+-------+

| pname |

+-------+

| Abir |

+-------+

142 | P a g e
select dname from patient,doctor where patient.pat_id=doctor.pat_id and pname='Abir';

+-----------+

| dname |

+-----------+

| dr.mahfuz |

+-----------+

143 | P a g e
select pname from patient where date_shifted='05-03-2019';

+-------+

| pname |

+-------+

| Abir |

+-------+

144 | P a g e
select pname from patient where date_checked_out='12-03-2019';

+-------+

| pname |

+-------+

| Abir |

+-------+

145 | P a g e
select test_name,result from test where pat_id=2001;

+-----------+----------+

| test_name | result |

+-----------+----------+

| hbs-ag | negative |

+-----------+----------+

146 | P a g e
8. Executive Information System (EIS):

An executive information system (EIS) is a decision support system (DSS) used to assist senior
executives in the decision-making process. It does this by providing easy access to important
data needed to achieve strategic goals in an organization. An EIS normally features graphical
displays on an easy-to-use interface.

Executive information systems can be used in many different types of organizations to monitor
enterprise performance as well as to identify opportunities and problems.

EIS helps management to monitor performance of the organization and thus helps organization
to achieve its goals and objectives in the long run.

Entities of EIS are as follows:


In HIS here we discussed five entities and each entity has several attributes as follows:

a) Company: comp_name, comp_address, comp_type, comp_id,record_id.


b) Chief Executive Officer(CEO): ceo_id, ceo_name, ceo_address, record_id.

147 | P a g e
c) Senior Executive Officer(SEO): seo_name, seo_id, _add, seo_salary, seo_performance,
record_id.
d) Employee: emp_name, emp_id, emp_dep, emp_salary, emp_performance, record_id.
e) Leave: LvEmp_id, LvEmp_dep, leave_status, leave_type, leave_no, record_id.
SQL query to form EIS database:

create table company(comp_id int not null auto_increment,comp_name


varchar(20),comp_address varchar(50),comp_type varchar(20),record_id int(5), primary
key(comp_id));

insert into company (comp_id,comp_name,comp_address, comp_type,record_id)


values(1001,'Zootech','Gulshan', 'tech', 2001);

create table CEO(ceo_id int not null auto_increment,ceo_name varchar(20),ceo_address


varchar(50),record_id int(5), primary key(ceo_id));

insert into CEO (ceo_id,ceo_name,ceo_address,record_id) values(3001, 'Suday', 'wari',4001);

create table SEO(seo_id int not null auto_increment,seo_name varchar(20),seo_address


varchar(50),seo_salary int(20),seo_performance varchar(10),record_id int(5), primary
key(seo_id));

insert into SEO (seo_id,seo_name,seo_address,seo_salary,seo_performance,record_id)


values(5001, 'Akbar', 'Savar',60000,’excellent’,6001);

create table Employee(emp_id int not null auto_increment,emp_name varchar(20),emp_dept


varchar(50),emp_salary int(20),emp_performance varchar(10),record_id int(5), primary
key(emp_id));

insert into Employee(emp_id,emp_name,emp_dept,emp_salary,emp_performance,record_id)


values(7001,’Asgar’,’HRD’,45000,’Excellent’,8001);

create table LV(lvEmp_id int not null auto_increment,lvEmp_name varchar(10),leave_dep


varchar(20),leave_stat varchar(10),leave_type varchar(20),leave_no int(5),record_id
int(5),primary key(lvEmp_id));

148 | P a g e
comp_addres comp_id
s
comp_name
Company
insert into LV (lvEmp_id,lvEmp_name,leave_dep,leave_stat,leave_type,leave_no,record_id)
comp_type
record_id
values(8001,’Asad’,’Finance’,’on_leave’,’casual_leave’,01,9001);
Has

ER diagram of EIS: ceo_name


ceo_id CEO

record_id
ceo_address
Direct seo_addres
s s
seo_name seo_id
record_id

SEOs
seo_salary seo_performance

emp_id
Mana
emp_name ges
Employee

emp_dept
lvEmp_id
record_id
emp_salary
Leave lvEmp_name

emp_performance leave_no
leave_dep
leave_type
record_id leave_stat

149 | P a g e
Result and Discussion:

150 | P a g e
151 | P a g e
152 | P a g e

You might also like