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

Write a class in Java (class it Insurance) that contains: a. private instance va

ID: 3843565 • Letter: W

Question

Write a class in Java (class it Insurance) that contains: a. private instance variable (String) called polType (meaning policy type, default is "auto") b. private instance variable (String) called stare (default is "NA") c. private instance variable (int) called number (default is 11111111) A. a public constructor which has ONE String parameter. Assign the default values to the instance variables (if not done in the declarations). Call the mutator/modifer method for possibly changing the instance variables, which is method B (passing the String parameter): (OTHER METHODS WOULD BE IN THIS CLASS, NOT SPECIFIED FOR THIS TEST) a. private instance method (mutator or settor) with ONE String parameter and NO return value to try to assign to the instance variables, but FIRST check if the String parameter is null or the length isn't 14 (if so, return) break the String into 3 substrings, first will have the 1st 4 chars of the parameter, second will have the next 2 chars of me parameter, and the third will have the rest of the parameter call the mutator for the polType, passing the first substring (details in C below) call the mutator for the state, passing the 2nd substring (details in D below) check if all the chars in the third substring are digits (if NOT, return) convert the third substring into an int, and call the mutator for the number (passing the value just got from converting) (details in E below) C. public instance method that's a mutator for the polType (returns a boolean has a String parameter) in which you assign the parameter to the polType instance variable if the parameter isn't null and equals "auto", "home" or "rent" (and return true), otherwise don't assign anything and return false D. public instance method that's a mutator for the state (returns a boolean, has a String parameter) in which you assign the parameter to the state instance variable if the parameter isn't null, has exactly 2 chars, and each char is 'A' through '2' (and return true), otherwise don't assign anything and return false. E. public instance method that's a mutator for the number (returns a boolean, has an int parameter) in which you assign the parameter to the number instance variable if the 1000

Explanation / Answer

#include <stdio.h>
#include <conio.h>
#include<string.h>
void printwords(const char *);
main()
{
FILE *fp;
char filename[20];
printf("Enter a file to print: ");
scanf("%s",&filename);
printwords(filename);
getch();
}
void printwords(const char *filename)
{
   FILE *fp;
   int n = 0;
   char word[20];

   if((fp = fopen(filename, "r")) != NULL)
      {while( fscanf(fp,"%s",word)!=EOF)
        printf("%s ",word);
       }
fclose(fp);
}

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