BCSL-021 SOLVED ASSIGNMENT FOR BCA 2nd semester


Q:-  write an interactive program which prompts the user with the following options on the opening menu:

1) Student Information
2) Course Material Despatch Status
3) Fee Status (Paid or Due for Payment)
4) Time Table for Theory Counselling
5) Time Table for Practical Counselling
6) Assignment Submission Schedules
7) Change of the Correspondence Address
8) General Queries
9) Quit Enter your choice:
 If a “1” is entered, prompt the student for the enrolment number and display the student information containing the details the semester he registered for, year of study, name of the programme, batch, duration details, name of the study centre, name of the regional centre, details regarding the fees s/he paid etc . If “2” is entered course material despatch status should be displayed whether it was sent or due for despatch. If “3” is entered fee status for the particular semester should be displayed. If “4” is entered, it should give the schedule for the theory counseling upon giving the batch number as input. If “5” is entered, it should give the schedule for the practical counseling upon giving the batch number as input. If “6” is entered the assignment submission schedules need to be displayed. If “7” is entered it should display the present correspondence address and should prompt the user to enter the change in the same if any and the necessary file is to be updated with the revised address. If “8” is entered it should present the general frequently asked questions. If “9” is entered, it should exit from the program. If the user enters any letters or numbers other than the choice, redisplay the prompt. All output should go to the terminal and all input should come from the keyboard.


answer:-





#include < conio.h > 
 #include < stdio.h >   
struct bcastudent {     
int enrol;     
char name[10];     
int sem;     
int batch; 
 char th[50];     
char pr[50];     
char stcode[10];     
char add[150];   

s; 

FILE * f1, * f2; 
int i, 
amount, 
rol; 
char chh[150]; 
int ch; 
int b, p; 
void addrecord() 

{

 f1 = fopen("data1", "ab");   
printf("\nEnter the Enrolment No=");   
scanf("%d", & s.enrol);   
printf("\nEnter the Programme name=");   
scanf("%s", s.name);   
printf("\nEnter the semester=");   
scanf("%d", & s.sem);   
printf("\nEnter the batch(integer)=");   
scanf("%d", & s.batch);   
printf("\nEnter the Theory Conselling=");   
scanf("%s", s.th);   
printf("\nEnter the Practical Conselling=");   
scanf("%s", s.pr);   
printf("\nEnter the study center code=");   
scanf("%s", s.stcode);   
printf("\nEnter the Address");   
scanf("%s", s.add);   
fwrite( & s, sizeof(s), 1, f1);   
fflush(stdin);   
fclose(f1); 



void disprecord() {   
   f1 = fopen("data1", "r+b");   
   fflush(f1);   
   rewind(f1);   
   while (fread( & s, sizeof(s), 1, f1)) {     

       printf("\nEnrollment=%d\n", s.enrol);     
       printf("Programme Name=%s\n", s.name);     
       printf("Semester=%d\n", s.sem);     
       printf("Study Center=%s\n", s.stcode); 

     printf("Address=%s\n", s.add);     
     printf("Batch=%d\n", s.batch);
   } 

  close(f1); 

   } 

void searchrec() {   
    f1 = fopen("data1", "rb+");   
    printf("Enter the Enrolment NO.");   
    scanf("%d", & rol);   rewind(f1);   
    while (fread( & s, sizeof(s), 1, 
         f1)) {     if (rol == s.enrol) {      

 printf("\nEnrollment=%d\n", s.enrol);      
 printf("Programm name=%s\n", s.name);       
 printf("Semester=%d\n", s.sem);       
 printf("Study Center=%s\n", s.stcode);      
 printf("Address=%s\n", s.add);      
 printf("Batch=%d\n", s.batch);    
   }
       }  

close(f1);
 } 
    void searchtheory() {   

    f1 = fopen("data1", "rb+");   
    printf("Enter the Batch NO.");   
    scanf("%d", & b);   rewind(f1);   
    while (fread( & s, sizeof(s), 1, f1))
 { 
    if (b == s.batch) 
{       
    printf("Theory counselling=%s\n", s.th);       
    printf("Batch=%d\n", s.batch);    
 }   
     }   
   
    close(f1);

 } 

void searchpr() 
   {   

f1 = fopen("data1", "rb+");   

printf("Enter the Batch NO.");   
scanf("%d", & p);   rewind(f1);   
while (fread( & s, sizeof(s), 1, f1)) 

{     
if (p == s.batch) 


 printf("Theory counselling=%s\n", s.p r);       
printf("Batch=%d\n", s.batch);     
}  
    }  

 close(f1);

 } 

void chadd() 

{     

f1 = fopen("data1", "rb+");     
clrscr();     printf("enter the Enroll. NO.");     
scanf("%d", & rol);     
printf("Enter the New Address");     
scanf("%s", chh);     rewind(f1);     
while (fread( & s, sizeof(s), 1, f1)) 

{       
if (rol == s.enrol) 
{         
strcpy(s.add, chh);         
printf("Your new address is = % s\ n ",s.add);           
fseek(f1, -i, SEEK_CUR); 
fwrite( & s, sizeof(s), 1, f1); 
fflush(f1);         
}      
      }       

close(f1);     

}     main() 

{         char chh = 'y';         i = sizeof(s);
         do {           clrscr();
           printf("\n\t **WWW.KHOJI.NET * * \n ");
               printf("\Programming Classes Raman ,Author ");                 

printf("\n***************************************** * * * * * * * * * * * * * \n ");                   printf("\n\n 0-Add Student Details:");        
   printf("\n\n 1-Display student information:");        
   printf("\n\n 2-Course Material Dispatch Status:");        
   printf("\n\n 3-Fee Status:");        
   printf("\n\n 4 -Theory Counselling:");         
   printf("\n\n 5-Practical Counselling:");         
   printf("\n\n 6-Assignment Submission:");        
   printf("\n\n 7-Change Address:");         
   printf("\n\n 8-General Quesries:");        
   printf("\n\n 9-Quit:"); 


 printf("\n\n*************************************** * * * * * * * * * * * ** * \n ");                  
 printf("\n\n Enter your choice:");        
 scanf("%d", & ch);                   
 switch (ch) {    

         

case 0:                    
                    addrecord();
                     break;                     
case 1:                     
                     searchrec();  
                     break;                     
case 2:   
                     printf(“Study Material Is Dispatched Please Contact Your Study Centre For More                       Information.\n”); 

 case 3:   
                      print(“Your Fee Status Is Paid.\n”); 

case 4:                     
                      searchtheory();
                      break;                     
case 5:                     
                       searchpr();
                       break;                      
case 6:                     
                       printf("\n****Assignment Submission Date*** * * \n ");                                                                   printf("\nBatch1===> 22 March"); printf("\nBatch2===> 23 March");                                         printf("\nBatch3===> 24 March"); printf("\nBatch4===> 25 March");                                     break; 


case 7:                         
                       chadd();                         
                   break;                        
case 8:                         
                       disprecord();                         
                   break; 
case 9:                         
                       exit(0);
                       break;                       
                      default:   
                      printf("\wrong choice");     
                  } 


                 printf("\n\nDo you want to continue(y/n)");
                 chh = getche(); 
                      } 
                 while (chh == 'y');
                  getch();  
                 }   









Comments