Unlike the Federal income tax, most states do not require some form of state income tax.
True
False
Solution
Correct answer is True
Unlike Federal income tax, most states do not require some form of state income tax - This
statement is true as fililng of Fedral income tax return is mandatory for almost everybody but
some US states like Alaska, Florida, Navada, South Dakota, Texas, Washington and Wayoming
do not require filing of state income tax..
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
1. Using standard libraries like stdio and sdtlib.h and using stats.h and stats.c and other files like
min.c max.c etc. along with an external file grades.txt
along with these pictures is an output file for reference. Description Your task is to create a
personal library to implement a statistic package on any given data (assume that the data is
always of type float). To do this you must create: 1. a header file (stats h) with 5 function
prototypes: maximum() minimum. 0 equation: x yxij mean N-1 variance equation: o histogram0
2. five (5) implementation files with each of functions listed above min. c, max. c, mean C
variance C and histogram .c You will then write C code (main.c that asks the user for the data
file he/she wishes to compute the statistics for and displays the results to the user. YoU WILL
NOT WRITE ANY STATISTICS FUNCTIONS IN main.c you will simply call the functions
prototyped in stats h and coded in min. c max.c, mean C variance C and histogram. c Procedure:
Refer to textbook pg 669-6770 1. Create the header file stats.h a. Start with a block comment
summarizing the purpose of the header file b. define any constant that you need for the header
file (NOT YOUR CODE) c. Individual function prototypes (with introductory comments stating
purpose of each function) d. Save e. Below is the template for stats.h
Solution
//stats.h
#ifndef STATS_H
#define STATS_H
float minimum(float grades[], int Size); // NOTE: You need to complete the prototypes
float maximum(float grades[], int Size);
float mean(float grades[], int Size);
float variance(float grades[], int Size);
void histogram(float grades[], int ArrayCount[], int Size);
#endif // STATS_H
//min.c
#include
#include
#include "stats.h"
float minimum(float grades[], int Size)
2. {
int min = grades[0];
for (int i = 0; i < Size; ++i)
{
if(grades[i] < min)
min = grades[i];
}
return min;
}
//max.c
#include
#include
#include "stats.h"
float maximum(float grades[], int Size)
{
int max = grades[0];
for (int i = 0; i < Size; ++i)
{
if(grades[i] > max)
max = grades[i];
}
return max;
}
//mean.c
#include
#include
#include "stats.h"
float mean(float grades[], int Size)
{
float sum = 0;
3. for (int i = 0; i < Size; ++i)
{
sum = sum + grades[i];
}
return sum/Size;
}
//variance.c
#include
#include
#include "stats.h"
float variance(float grades[], int Size)
{
float sum = 0;
for (int i = 0; i < Size; ++i)
{
sum = sum + grades[i];
}
float avg = sum/Size;
sum = 0;
for (int i = 0; i < Size; ++i)
{
sum = sum + (grades[i] - avg)*(grades[i] - avg);
}
return (sum/Size);
}
//histogram.c
#include
#include
6. ///Call Intro Comment
WelcomeToTheProgram();
///Enter Filename
printf(" Enter the data filename: ");
scanf("%s", fileName);
//Get # of grades in file
num_grades = readGrades(fileName, grades); //get # of grades in file
///Print Results
printf("There are %d grades read ", num_grades);
printf("Mean = %f ", mean(grades, num_grades));
printf("Variance = %f ", variance(grades, num_grades));
printf("Maximum = %f ", maximum(grades, num_grades));
printf("Minumum = %f ", minimum(grades, num_grades));
//Call histogram
histogram(grades, ArrayCount, num_grades);
//Print the histogram
printf("Grade Histogram ");
for (i = 0; i < 10; i++)
{
if (i != 9)
{
printf(" %d %% - %d %%: %d ", i * 10, ((i + 1) * 10) - 1, ArrayCount[i]);
}
else
{
printf(" 90 %% - 100 %%: %d ", ArrayCount[i]);
}
}
return 0;
}
///Reads all grades from the file to array
int readGrades(char fileName[], float grades[])
7. {
FILE *fpin = fopen(fileName, "r");
int num_scores = 0;
float value;
if (fpin == NULL)
{
printf("Cannot open the file ");
exit(0);
}
while ((fscanf(fpin, "%f", &value)) != EOF)
{
grades[num_scores] = value;
num_scores++;
}
return num_scores;
}
void WelcomeToTheProgram()
{
printf("***Welcome to the Program Which Involves a Custom Library***");
printf(" The program finds the minimum value, maximum value, mean,");
printf("variance, and a histogram of the grades of data by calling");
printf("implementation files min(), max(), mean(), variance(), and histogram(). ");
}
/*
compile: cc main.c min.c max.c variance.c mean.c histogram.c
run ./a.out
grades.txt
60.2
84.9
57.4
70.2
68.4
55.3
42.3
55.4
54.1