NEWS & UPDATES >> BCA BCSP064 Synopsis & Project Work Started for DEC 2017, IGNOU MCA MCSP060 Synopsis Work Started for DEC 2017, CONTACT 4 IGNOU Mini Project

IGNOU BCA Study-WHAT IS PROGRAM DEVELOPMENT LIFE CYCLE & WRITE THE LIST OF LAB ASSIGNMENTS – SESSIONWISE


WHAT IS PROGRAM DEVELOPMENT LIFE CYCLE
The four steps in the program development life cycle:

!
Design algorithm








!
Draw flowchart




!
Program coding




!
Testing for various inputs




Example 1




Represent the complete steps in the program development life cycle that reads the


number of letter grades A, B, C, D and F for a student. The program will compute and


print the student's grade point average. It should then determine and print the


student's academic standing (like high honors, honors, satisfactory, or probation)


according to the following table:













Grade Point Average
Academic Standing





3.51 - 4.00
High Honors





3.00 - 3.50
Honors





2.00 - 2.99
Satisfactory





Less than 2.00
Probation


Note: In computing grade point average, assume that the weight of letter grade
A is 4, B is 3, C is 2, D is 1 and f is 0.

Step 1: Design the algorithm / pseudocode for the given problem

Print "Please enter your number of subject that your taken last semester"

Set CorrectStatusInput "no"

Print "Enter the number of grade A" Read number_of_ A

Print "Enter the number of grade B" Read number_ of_B

Print "Enter the number of grade C" Read number_of_C

Print "Enter the number of grade D" Read number_of_D

Print "Enter the number of grade F" Read number_of_F

Compute Total_subject = number of grade A + number of grade B + number of grade C + number of grade D + number of grade F

while CorrectStatusInput "no" and Total_subject < =0 begin

print "Enter number of grade A" read number of A

print "Enter number of grade B" read number of B

print "Enter number of grade C" read number of C

print "Enter number of grade D" read number of D

print "Enter number of grade F" read number of F

if (number_of_A greater than and equal 0 and number_of_B greater than and equal 0 and number_of_C greater than and equal 0 and number_of_ D greater than and equal 0 and number_of_F greater than 0) and ( Total_subject >0)

set CorrectStatusInput "yes"


end if

end end while

compute Total_point = number of grade A * 4 + number of grade B *3 + number of grade C*2 + number of grade D *1 + number of grade F *0

compute Total_average = Total point / Total subject

print Total_average
if Total_ average less than 2
print " Your academic standing is Probation"
else
if Total_average less than 3

print " Your academic standing is Satisfactory" else
if Total_average less than or equal 3.5

print " Your academic standing is Honors" else
if Total_average less than or equal 4.00

print " Your academic standing is High Honors" end_if
end_if
end_if
end_if

Step 2: Design a flowchart based on the algorithm.






Step 3: Translate the flowchart to C source code.

/* Program to computer and print the grade point average */

#include <stdio.h>

main()

{

int num_A,num_B,num_C,num_D,num_F; /* Variables declaration part*/ int total_subject;

int total_point ; float GPA;


do {

printf(" \tThis is for calculate your GPA \n"); printf("Enter number of grade A : ");
scanf ("%d", &num_A);

printf("Enter number of grade B : "); scanf ("%d", &num_B);

printf("Enter number of grade C : "); scanf ("%d", &num_C);

printf("Enter number of grade D : "); scanf ("%d", &num_D);

printf("Enter number of grade F : "); scanf ("%d", &num_F);

/* calculation of the total */

total_subject = num_A + num_B + num_C + num_D + num_F;

{

if (((num_A <0) || (num_B <0)||(num_C<0)||(num_D <0)||(num_F <0))||(total_subject <=0))
printf (" you should enter your number that you having take again\n");
}

} while (((num_A <0) || (num_B <0)||(num_C <0)||(num_D <0)||(num_F <0))||(total_subject <=0));

/* this to calculate and print total_subject, total_point and GPA */

total_point = num_A *4 + num_B*3 + num_C*2 + num_D*1 + num_F*0;


GPA =(float) (total_point / total_subject) ;

/* this to print total subject */

printf ("\nYour grade point average is %.2f \n",GPA);


/* this selection to get output the students status */

if (GPA <2)

printf ("Your academic standing is Probation\n\n"); else
if (GPA <3)

printf ("Your academic standing is Satisfactory\n\n"); else
if (GPA <= 3.5)

printf ("Your academic standing is Honors\n\n"); else
if (GPA <= 4.00)
printf     ("Your      academic      standing      is      High
honors\n\n");

return 0;
}

Step 4: Testing

OUTPUT

This is for calculate your GPA
Enter number of grade A: 3
Enter number of grade B: 2
Enter number of grade C: 2
Enter number of grade D: 0
Enter number of grade F: 0
Your grade point average is 3.14.
Your academic standing is Honors.
WRITE THE LIST OF LAB ASSIGNMENTS – SESSIONWISE
Session 1:

1.            Develop algorithm, flowchart and write an interactive program to calculate
simple        interest and compound interest.


2.            Design a flow chart and write an interactive program for the problem given below:

Assume that the United States of America uses the following income tax code

formula for their annual income: First US$ 5000 of income : 0% tax
Next US$ 10,000 of income          : 10% tax
Next US$ 20,000 of income          : 15% tax
An amount above US$ 35,000      : 20% tax.

For example, somebody earning US$ 38,000 annually would owe

US$ 5000 X 0.00 + 10,000 X 0.10 + 20,000 X 0.15 + 3,000 X 0.20,

which comes to US$ 4600. Write a program that uses a loop to input the income and calculate and report the owed tax amount. Make sure that your calculation is mathematically accurate and that truncation errors are eliminated.

3.            Design a flowchart and write an interactive program that reads in integers until a 0 is entered. If it encounters 0 as input, then it should display:

!       the total number of even and odd integers

!      average value of even integers

!      Average value of odd integers.
Note: Use switch statement for selection.

4. Write an interactive program to generate the divisors of a given integer.

Session 2:

5.            Write a program to find all Armstrong number in the range of 0 and 999

Hint: An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.

6.            Write a program to check whether a given number is a perfect number or not.

Hint: A positive integer n is called a perfect number if it is equal to the sum of all of its positive divisors, excluding n itself. For example, 6 is a perfect number, because 1, 2 and 3 are its proper positive divisors and 1 + 2 + 3 = 6. The next perfect number is 28 = 1 + 2 + 4 + 7 + 14. The next perfect numbers are 496 and 8128.

7.            Write a program to check whether given two numbers are amicable numbers or not.

Hint: Amicable numbers are two numbers so related that the sum of the proper divisors of the one is equal to the other, unity being considered as a proper divisor but not the number itself. Such a pair is (220,284); for the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, of which the sum is 284; and the proper divisors of 284 are 1, 2, 4, 71, and 142, of which the sum is 220.

8.            Write a program to find the roots of a quadratic equation.

Session 3:

9.             Write a function invert( x, p, n) that returns x with the n bits that begin at position p inverted. You can assume that x, p and n are integer variables and that the function will return an integer. As an example, if x = 181 [decimal] which is 10110101 in binary, and p = 4 and n = 2, then the function will return 10101101 or 173 [decimal]. The underlined bits are the changed bits. Note that           
bit positions are counted from the right to the left and that the counts start with a



0. Therefore, position 4 is the 5th bit from the rightvalues.    

10.         Write a function that calculates the compounded interest amount for a given initial amount, interest rate and number of years. The interest is compounded annually. The return value will be the interest amount. Use the following function definition: float comp_int_calc( float int_amt, float rate, int years);








Write a program that will accept the initial amount, interest rate and the number of years and call the function with these values to find out the interest amount and 





display the returned value.


11.        Break up the program that you wrote to solve Problem 10 into two separate source files. The main function should be in one file and the calculation function must be in another file. And modify the program so that the interest rate is a symbolic constant and is no longer input from the keyboard. And put all the C preprocessor directives into a separate header file that is included in the two program source files [i.e. #include "header.h"].

12.        Define two separate macros, MIN and MAX, to find and return, respectively, the minimum and maximum of two values. Write a sample program that uses these macros.

Hint: Use the ternary operator.

Session 4:

13.        Write a program that will take as input a set of integers and find and display the largest and the smallest values within the input data values.

14.        Write an interactive program that will take as input a set of 20 integers and store them in an array and using a temporary array of equal length, reverse the order of the integers and display the values.

15.        Write a interactive program to do the following computation by providing the option using the switch statement:

!       Add two matrices

!       Subtract two matrices

!       Multiply two matrices

Session 5:

16.        Write a program to check if the given matrix is magic square or not.

17.        Write a program print the upper and lower triangle of the matrix.

18.        Write a program to compute transpose of a matrix.

19.        Write a program to find the inverse of a matrix.

Session 6:

20.        Using recursion,

(i)          Find the factorial of a number

(ii)        Find Greatest Common Divisor (GCD) of two numbers

(iii)      To generate Fibonacci sequence

(iv)       Reverse 'n' characters. 

Session 7:

21.        Write a program to convert a given lowercase string to upper case string without using the inbuilt string function.

22.         Write a program to count number of vowels, consonants and spaces in a given string.

23.        Write a program to input a string and output the reversed string, i.e. if "USF" is input, the program has to output "FSU". You are not to use array notation to           access the characters, instead please use pointer notation.

Session 8:

24.         Write a program to process the students-evaluation records using structures.

25.         Define a structure that will hold the data for a complex number. Using this structure, please write a program that will input two complex numbers and output            the multiple of the two complex numbers. Use double variables to represent complex number components.

Note: A complex number z is a number of the form z = a + bi where a and b are real numbers. The term a is called the real part of z and b is called the imaginary part of z. The multiplication operation on complex numbers is defined as:

(a + bi) * (c + di) = (ac - bd) + (ad + bc)i

26.     Modify the above program so that the multiplication is carried out in a function that accepts two complex number structures as input parameters and return a          complex number structure with the result.

Session 9:

27.        Write a function that will return the length of a character string. You are not allowed to use the strlen C library function.


Note: Use "Pointers" concept

28.         Write a function that returns the minimum and the maximum value in an array of integers. Inputs to the function are the array of integers, an integer variable containing the length of the array and pointers to integer variables that will contain the minimum and the maximum values. The function prototype is:

void minmax( int array[], int length, int * min, int * max);

29.     Write a sample program that uses this function to find and display the minimum and the maximum values of an array of integers. Use an array of 10 integers.          You can either use scanf to input the values into that array or initialize the array with values in the program itself.

Session 10:

30.   Write a program that prompts the user the name of a file and then counts and displays the number of bytes in the file. And create a duplicate file with the                 word '.backup' appended to the file name. Please check whether file was successfully opened, and display an error message, if not.

31.         Write a program to create a file, open it, type-in some characters and count the number of characters in a file.

32.
Write a program that will input a person's first name, last name, SSN number

and age and write the information to a data file. One person's information

should be in a single line. Use the function fprintf to write to the data file.

Accept the information and write the data within a loop. Your program should

exit the loop when the word 'EXIT' is entered for the first name. Remember to

close the file before terminating the program.

Hint: Use the function strcmp() to compare two strings.
33.
Modify the program no: 23 using file concept.

No comments:

Post a Comment