C Language Loops Basic program writing, writing a C programs

Source: Internet
Author: User

C Language Loops Basic program writing, writing a C programs
In this project you'll demonstrate your understanding of loops and if statements by writing a program
That sequentially processes a file of text data. You is also expected to make use of functions (chapters
5 and 6) and Arrays (Chapter 7, covered in lectures in Weeks 6 and 7). The sample solution that would be
Provided to you'll also make use of structures (Chapter 8), and the May do likewise if you wish. But
There is no requirement for your make use of the struct types, and they'll not has been covered in
Lectures before the due date.
Sequential Data
Scientific and engineering datasets is often stored in text files using comma Separated values (. csv
format) or Tab Separated values (. tsv format), usually with a one-or Two-line header describing the
Contents of the columns.
The data file used in this project is generated by the city of Melbourne, and uses. TSV format to
Record pedestrians as measured by counting devices at a number of locations around the CBD1
. That data
File is then edited the test files provided on the LMS. In particular, some of the columns were
removed, some of the columns were reformatted, the hourly counts were aggregated into daily counts,
and three recording stations were extracted into separate files, with the rest of the recording stations
Discarded. Smaller subsets of those three data files were also then prepared, see the LMS and assignment
To a full set of data files. The first few and last lines of the file pedestrians-melbcent-full.tsv
is:
# Melbourne Central Daily Pedestrian Counts
# yyyy mm DD Day Daycount
2009 06 01) 2 22663
2009 06 02) 3 22960
2009 06 03) 4 23618
...
2018 02 27) 3 33722
2018 02 28) 4 33164
There'll always be the heading lines in all input files, and then rows of five values separated by
"tab" characters (' \ t ' in C). Once the first lines has been bypassed, each data line can is read
Using scanf ("%d%d%d%d%d",...). The number in the fifth column was the pedestrian count for the day
indicated by the dd/mm/yyyy date, with the fourth field, day, indicating the day of the week, numbered
From Sunday to Saturday as integers 1 to 7 respectively. You can open these data files using JEdit if
You wish to view them, and they can also be manipulated using Excel.
Stage 1–control of Reading and Printing (marks up to 4/10)
Your First program should read the entire input dataset to a collection of five parallel arrays (or, if you
is adventurous, an array of structs), counting the data rows as they is read. The heading Lines
Should is discarded and not processed on any.
1
See HTTP://GO.UNIMELB.EDU.AU/SHT6 for a link through to the source dataset, which is accessed from https:
data.melbourne.vic.gov.au on March 2018.
1
Once the entire dataset is in memory, your program should print the first and last of the input records,
And the total number of data lines that were read. The output from your program for the-stage for file
PEDESTRIANS-MELBCENT-FULL.TSV must be:
Mac:myass1 < PEDESTRIANS-MELBCENT-FULL.TSV
S1:total Data lines = 3067 days
S1:first Data line = 01/06/2009, 22663 people counted
S1:last Data line = 28/02/2018, 33164 people counted
Mac:
Note that the input was to being read from stdin in the usual manner, via ' < ' input redirection at the shell
Level And that, should not try and make, use of the file manipulation functions described in Chapter 11.
You may (and should) assume, at most, would be covered by the input data. Note that
Some of the marking process would be automatic, and you should seek to exactly reproduce these three
Output lines. Further examples can be found on the FAQ page linked from the LMS.
Stage 2–computing Stuff (marks up to 6/10)
Now add further-functionality to your-so-it computes the number of entries there would be
In the given date range if every day had a corresponding line in the data file. For the same data file, these
Additional lines should appear in your program ' s output:
S2:range spanned = 3195 days
S2:coverage ratio = 96%
The range spanned is the number of days (including the endpoints) in the date range
Reported in Stage 1, and the coverage ratio are the percentage of dates in this range for which the data
file contains pedestrian count records. In this example, there is 3195 days between 1 June and 28
February 2018 (inclusive), and 3067/3195 is 96%. You can check date range calculations using Excel.
Note that code should was shared between the stages through the use of functions wherever it is
possible to doing so. In particular, there shouldn ' t is long (or even short) stretches of repeated or similar
Code appearing in different places on your program. Functions should also be used to break up long runs
of code, to do them more understandable, even if those functions is only called once. As a general
Rule of thumb, functions shouldn ' t be longer than a, the editor. If They is, break that code
Up further into smaller functions.
Assume that the data records is presented in strictly increasing date order, and so you
is not a required to sort them. Note also that there'll be no duplicate dates. On the other hand, you
Must not assume that there would be a particular year range in the input data, and must not assume that
The months and dates'll be exhaustive (there is missing days, missing months and maybe even
Missing years).
Stage 3–make Summary Report (marks up to 8/10)
Modify your program further so it also generates a "by the month" listing showing the average
Observed daily pedestrian numbers for each month for which there was any data provided in the input
Listing. Months that has no daily data provided should not being included in the output. For this stage, the
Required output for the test file PEDESTRIANS-MELBCENT-P100.TSV (with a total of 98 data lines) is:
s3:06/2009 28/30 days covered, average count = 24.8k
s3:07/2009 31/31 days covered, average count = 26.7k
s3:08/2009 31/31 days covered, average count = 26.7k
s3:09/2009 8/30 days covered, average count = 24.4k
where "K" means "thousands". See the LMS for the full output of associated with the test files.
2
Stage 4–find The Trend (marks up to 10/10)
The Melbourne City Council was concerned that pedestrian traffic was increasing, and that the footpaths was
Becoming congested. To help them understand the growth rate over the sample period, further modify
Your program so, the input data is split into Ngrps near-equal sized (in terms of data records in the
Input file) groups of consecutive data lines from the input, where you should assume that Ngrps are to
Be three at present. The group sizes should is computed so, they differ by at most one from each
Other, and so, all input data line are in exactly one of the groups. There is several examples of the
Required output linked from the FAQ page.
The average number of pedestrians for each day of the week for each of the groups should then be
Computed, and plotted as a simple bar chart, to highlight any variations over the days of the week and
Over the Ngrps groups. For the data file PEDESTRIANS-MELBCENT-FULL.TSV the additional output from
Your program should is:
S4:group 0 data, 01/06/2009 to 20/03/2012, 1022 data records
S4:group 1 data, 21/03/2012 to 08/01/2015, 1022 data records
S4:group 2 data, 09/01/2015 to 28/02/2018, 1023 data records
S4:sun, G0 = 22.2k |**********************
S4:sun, G1 = 27.6k |****************************
S4:sun, g2 = 28.8k |*****************************
S4:mon, G0 = 24.4k |************************
S4:mon, G1 = 27.6k |****************************
S4:mon, g2 = 28.3k |****************************
S4:tue, G0 = 24.9k |*************************
S4:tue, G1 = 28.6k |*****************************
S4:tue, g2 = 29.3k |*****************************
And so on, covering the other four days too, see the LMS for full output, where each ' * ' represents
(correctly rounded off) one thousand people. Note that Ngrps should is a #define in the Your program,
And that, you should test your program using a range of values to ensure, the right output is produced.
Modifications to the specification
There is bound to being areas where this specification needs clarification or correction. Refer to the
For updates to these instructions. There is already a range of information provided there so you need to
Is aware of, with + to follow.
Real Software
If you want to explore a much more sophisticated analysis tool for this pedestrian data, go via the redirection
The boring Stuff ...
This project is worth 10% of your final mark. A Rubric explaining the marking expectations'll be
Provided on the FAQ page.
You need-to-submit your program for assessment; Detailed instructions on what to does that would be
Posted on the LMS once submissions is opened. Submission'll is not being done via the LMS; instead
Would need to log on to a Unix server and the submit your files to a software system known as submit. You can
(and should) use submit both early and often–to get used to the the-the-it works, and also to check that
3
Your program compiles correctly in our test system, which have some different characteristics to the lab
Machines. Failure to follow this simple advice is highly likely to result in tears. The last submission
That's before the deadline would be marked.
Discuss your work during your workshop, and with others in the class, but what gets typed
into your program must is individual work, not copied from anyone else. So, don't give hard copy
or soft copy of your work to anyone else; Don't "lend" your "Uni backup" Memory stick to others
For any reason on all; And do don't ask others to give you their programs "just so that I can take a look
And get some ideas, I won ' t copy, honest. The best-of-help your friends-regard is-say a
Very firm "no" when they ' ask for a copy of, ' or to ' see, ' Your program ', ' pointing out ' that your ' no ', and
Their acceptance of that decision, was the only thing that would preserve your friendship. A sophisticated
Program this undertakes deep structural analysis of C code identifying regions of similarity'll be run
Over all submissions in "compare every pair" mode. Students whose programs is so identified would be
Referred to the Student Center for possible disciplinary action without further warning. This message is
The warning. Note Also
That solicitation of solutions via posts to online forums, whether or not there are payment involved, is also
Taken very seriously. In the past students has had their enrolment terminated for such behavior.
Deadline:programs not submitted by 10:00am on Monday (April) would lose penalty marks
At the rate of both marks per day or part day late. Students seeking extensions for medical or other
"Outside my control" reasons should email [email protected] as soon as possible after those
circumstances arise. If you attend a GP or other health care professional as a result of illness, be sure
To take a health Professional report form with your get it from the special consideration section of the
Student Portal), you'll need this form to being filled out if your illness develops in to something that later
Requires a special consideration application to be lodged. You should scan the HPR form and send it in
Connection with any Non-special consideration assignment extension requests.
Marks and a sample solution is available on the LMS by Monday.
And remember, programming is fun!
Http://www.6daixie.com/contents/13/1347.html

Our Direction field: Window Programming numerical algorithm AI Artificial Intelligence financial statistical Metrology analysis Big Data network programming Web programming Communication Programming game Programming Multimedia Linux plug-in programming API image processing embedded/Microcontroller database programming console process and thread Network security assembly language Hardware programming software Design Engineering Standard Rules. The generation of programming languages or tools including, but not limited to, the following ranges:

C/c++/c# Write

Java Write generation

It generation

Python writes

Tutoring Programming Jobs

The MATLAB Generation writes

Haskell writes

Processing Write

Linux Environment Setup

Rust Generation Write

Data Structure assginment Data structure generation

MIPS Generation Writing

Machine Learning Job Writing

Oracle/sql/postgresql/pig database Generation/Generation/Coaching

Web development, Web development, Web site jobs

Asp. NET Web site development

Finance insurace Statistics Statistics, regression, iteration

Prolog write

Computer Computational Method Generation

Because of professional, so trustworthy. If necessary, please add qq:99515681 or e-mail:[email protected]

: Codinghelp

C Language Loops Basic program writing, writing a C programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.