


CODE:
#include<stdio.h>
int main()
{
char line[512];
char *months[] = {"", "Jan", "Feb", "Mar", "Apr", "May",
"Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
int id[11],yr,mo[11],i=0,j;
char c[11];
char str[] = "IDCJAC0001";
double r[11];
FILE *info; // create info pointer
info = fopen("val.csv","r"); // open text file called info,
read
fscanf(info,"%d, %d, %d,%lf,%c" ,&id[i], &yr, &mo[i],
&r[i], &c[i]);
//printf("\n%s\t,%d\t, %d\t, %d\t, %lf\t,
%c\t",str,id[i],yr,mo[i],r[i],c[i]);
i++;
while(fgets(line, 512, info) != NULL)
{
fscanf(info,"%d, %d, %d,%lf,%c" ,&id[i], &yr, &mo[i],
&r[i], &c[i]);
//printf("\n%s\t,%d\t, %d\t, %d\t, %lf\t,
%c\t",str,id[i],yr,mo[i],r[i],c[i]);
i++;
}
printf("\n");
fclose(info);
printf("\nmac: ass2-soln < rainfall-086039-2000-2009.csv\nS1,
sitenumber 086039, 115 datalines in input\n");
printf("S1, 2000: ");
for(j=0;j<i;j++)
{
if(mo[j]-mo[j-1]!=1)
{
int x = mo[j]-mo[j-1],k;
for(k=1;k<x;k++)
printf("\t...");
if(c[j]=='Y')
printf("\t%s",months[mo[j]]);
else
printf("\t%s*",months[mo[j]]);
}
else
{
if(c[j]=='Y')
printf("\t%s",months[mo[j]]);
else
printf("\t%s*",months[mo[j]]);
}
}
printf("\n");
return 0;
}
I took a sample input of what you provided:
086039,2000,01,28.2,Y
086039,2000,02,34.5,Y
086039,2000,03,22.5,Y
086039,2000,06,42.4,Y
086039,2000,07,45.1,Y
086039,2000,08,45.1,Y
086039,2000,09,45.1,Y
086039,2000,10,45.1,Y
086039,2000,11,45.1,N
086039,2000,12,45.1,Y
Output for it is:

For another input:
086039,2000,01,28.2,Y
086039,2000,02,34.5,Y
086039,2000,03,22.5,Y
086039,2000,05,96.3,Y
086039,2000,06,42.4,Y
086039,2000,07,45.1,Y
086039,2000,08,45.1,Y
086039,2000,09,45.1,Y
086039,2000,10,45.1,Y
086039,2000,11,45.1,N
086039,2000,12,45.1,Y

In this stage you should read all of the data into internal structures suitable for use in the later stages and create...
Code with Java using arrays and Scanner only ( input should end with 0 to terminate the program) Everyone loves to be celebrated on their birthdays. Birthday celebration can encourage positive social interaction among co-workers, foster friendship among classmates or even strengthen bond between families. Birthday graph can be display in many forms. It can a creative drawing consists of cupcakes, balloons, candles with names, or it can be in the form of simple bar chart to indicate the birthday...
C++ Write a function parseScores which takes a single input argument, a file name, as a string. Your function should read each line from the given filename, parse and process the data, and print the required information. Your function should return the number of student entries read from the file. Empty lines do not count as entries, and should be ignored. If the input file cannot be opened, return -1 and do not print anything. Your function should be named...
(Python)
Write a program called sales.py that uses a list to hold the
sums of the sales for each month. The list will have 12 items with
index 0 corresponds with month of “Jan”, index 1 with month “Feb”,
etc.
o Write a function called Convert() which is passed a string
which is a month name (ex. “Jan”) and returns the matching index
(ex. 0). Hint – use a list of strings to hold the months in the
correct order,...
Capitalization JAVA In this program, you will read a file line-by-line. For each line of data (a string), you will process the words (or tokens) of that line one at a time. Your program will capitalize each word and print them to the screen separated by a single space. You will then print a single linefeed (i.e., newline character) after processing each line – thus your program will maintain the same line breaks as the input file. Your program should...
Using C++, create a doubly linked list data structure that stores strings. At a minimum, you must have a List class that contains the list functionality (including an insert function) and a linkable object ("link node") class. For convenience, you may include the data directly or the data may be external to the link node, connected with a reference. You may use an inner class for the LinkNode and/or include the LinkNode class with the List class file if you...
Using C++, create a doubly linked list data structure that stores strings. At a minimum, you must have a List class that contains the list functionality (including an insert function) and a linkable object ("link node") class. For convenience, you may include the data directly or the data may be external to the link node, connected with a reference. You may use an inner class for the LinkNode and/or include the LinkNode class with the List class file if you...
Write a program that demonstrates use of programmer - defined
data structures. Please provide code! Thank you.
Here are the temps given:
January 47 36
February 51 37
March 57 39
April 62 43
May 69 48
June 73 52
July 81 56
August 83 57
September 81 52
October 64 46
November 52 41
December 45 35
Janual line Iranin Note: This program is similar to another recently assigned program, except that it uses struct and an array of...
Use C++
For this week’s lab you will write a program to read a data file
containing numerical values, one per line. The program should
compute average of the numbers and also find the smallest and the
largest value in the file. You may assume that the data file will
have EXACTLY 100 integer values in it. Process all the values out
of the data file. Show the average, smallest, largest, and the name
of the data file in the...
Assignment You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to a file or to the console depending on the command line arguments. Furthermore, your program will restrict the output to the starting and ending dates given by the user. The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued: Interstate...