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

Using Java Example program discussed in class and included in FLIP_FILES.zijp Th

ID: 3754209 • Letter: U

Question

Using Java

Example program discussed in class and included in FLIP_FILES.zijp The names of the input and output files should be, respectively: YourName_S_04_Input.txt YourName_S_04_Output.txt Using iGrasp l File | New | Plain Text or Notepad on a PC or TextEdit on a Mac, create an input text file which contains the information below. (On the Mac, use the TextEdit feature that saves files as txt files, not .rtf files.). The input file has this information in order of gross pay, savings percentage rate and IRA investment rate 100.00 10.0.50 000.00 11 6 000.00 11 6 1234.5610.5 6.0 6543.21 10 5.0 10000 12 10 -1000 10.00 5.00 4444.22 10.2 4.9 2222.44 11.9 10 3141.59 12 5.0 Insert code that calculates the savings amount and the IRA investment amount from the numbers for valid lines that are read from the input file. You will also calculate the averages of the gross pay, savings amount and investment amount for all input lines that are valid. Valid input lines have all three input numbers

Explanation / Answer

#include <stdio.h>

int main()

{

      int temp1 = 0, temp2 = 0, temp3 = 0;

   

      while(temp1 != -1)

      {

          

            printf("Enter an integer, -1 to stop it: ");

            scanf("%d", &temp1);

            if(temp1 != -1)

            {

                 temp2= temp1 % 3;

                 temp3 = temp1 % 7;                 

                 

                  if((temp2 == 0) && (temp3 == 0))

                        printf("Is %d divisible by 3 and 7? true ", temp1);

                  else

                        printf("Is %d divisible by 3 and 7? false ", temp1);

                  if((num2 == 0) ||(num3 == 0))

                        printf("Is %d divisible by 3 or 7? true ", temp1);

                  else

                        printf("Is %d divisible by 3 or 7? false ", temp1);

                  if(((temp2 == 0) ||(temp3 == 0)) && !((temp2 == 0) && (temp3 == 0)))

                        printf("Is %d divisible by 3 or 7? true ", temp1);

                  else

                        printf("Is %d divisible by 3 or 7? false ", temp1);

            }

            printf(" ");

          }   

      printf("You asked to stop. ");

      return 0;

}

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