Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment Description: Design and implement a simple text processor application

ID: 3592694 • Letter: A

Question

Assignment Description: Design and implement a simple text processor application. As shown in the screenshot below, the left hand side TextArea (while is scrollable), allows the user to either type of copy and paste the text to be processed. Your text processor allows the user the change the font size of the text based on the Radio button selections. As the user is selecting the appropriate font size button, the textArea will change font size of the text. Large is selected by default Analysis can be done in three ways, word count, vowel count, and character count. The analysis type is given as check boxes. The user can select one, two, or all three analysis types. As, the user select this option, the analysis results textField shows the analysis results.

Note: You can use a suitable layout such as BorderLayout, GridLayout, and combinations of them in your implementation.

Results textField Input textarea Text Processor Analysis Results Size Analysis Type Small Medium Large Word Count Character Count T-Vowel Count Analysis type selection check boxes Font size change radio buttons

Explanation / Answer

#include<stdio.h>
#include<conio.h>
#include<process.h>
int i,j,ec,fg,ec2;
char fn[20],e,c;
FILE *fp1,*fp2,*fp;
void Create();
void Append();
void Delete();
void Display();
void main()
{
do {
clrscr();
printf(" ***** TEXT EDITOR *****");
printf(" MENU: ----- ");
printf(" 1.CREATE 2.DISPLAY 3.APPEND 4.DELETE 5.EXIT ");
printf(" Enter your choice: ");
scanf("%d",&ec);
switch(ec)
{
   case 1:
     Create();
     break;
   case 2:
     Display();
     break;
   case 3:
     Append();
     break;
   case 4:
     Delete();
     break;
   case 5:
     exit(0);
}
}while(1);
}
void Create()
{
fp1=fopen("temp.txt","w");
printf(" Enter the text and press '.' to save ");
while(1)
{
c=getchar();
fputc(c,fp1);
if(c == '.')
{
   fclose(fp1);
   printf(" Enter then new filename: ");
   scanf("%s",fn);
   fp1=fopen("temp.txt","r");
   fp2=fopen(fn,"w");
   while(!feof(fp1))
   {
    c=getc(fp1);
    putc(c,fp2);
   }
   fclose(fp2);
   break;
}}
}
void Display()
{
printf(" Enter the file name: ");
scanf("%s",fn);
fp1=fopen(fn,"r");
if(fp1==NULL)
{
   printf(" File not found!");
   goto end1;
}
while(!feof(fp1))
{
   c=getc(fp1);
   printf("%c",c);
}
end1:
fclose(fp1);
printf(" Press any key to continue...");
getch();
}
void Delete()
{
printf(" Enter the file name: ");
scanf("%s",fn);
fp1=fopen(fn,"r");
if(fp1==NULL)
{
   printf(" File not found!");
   goto end2;
}
fclose(fp1);
if(remove(fn)==0)
{
   printf(" File has been deleted successfully!");
   goto end2;
}
else
   printf(" Error! ");
end2: printf(" Press any key to continue...");
getch();
}
void Append()
{
printf(" Enter the file name: ");
scanf("%s",fn);
fp1=fopen(fn,"r");
if(fp1==NULL)
{
   printf(" File not found!");
   goto end3;
}
while(!feof(fp1))
{
   c=getc(fp1);
   printf("%c",c);
}
fclose(fp1);
printf(" Type the text and press 'Ctrl+S' to append. ");
fp1=fopen(fn,"a");
while(1)
{
   c=getch();
   if(c==19)
    goto end3;
   if(c==13)
   {
    c=' ';
    printf(" ");
    fputc(c,fp1);
   }
   else
   {
    printf("%c",c);
    fputc(c,fp1);
   }
}
end3: fclose(fp1);
getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote