CS 222:Computer Programming for Engineers
Homework # 4 Rubric
Most computers on the internet have a 32 bit Internet Protocol Version 4
(IPv4) address. As reading these addresses would be difficult using
binary or hexadecimal notation, IPv4 addresses are usually represented
in dotted decimal notation.
For purposes ofrepresentation,the 32 bits composing the address may
be divided intofour octets (bytes) written in decimalnumbers, each
rangingfrom 0 to 255, and concatenatedas a character string with a full
stop (ASCII 46)betweeneach number.
For example:
The first two components of theaddressindicate the computer’s locality
on the network.In theabove example, the locality is specified by the
numbers172 and16.
Anotherexample:
Locally, computers are often known by an alias (nickname) as
well. You will design and write a program to process a list of Internet
addresses from file “CS222_Inet.txt”. Your program should read a list of
up to 100 addresses andnicknames terminated bya sentinel address of
all zeros and the sentinel nickname, “NONE”.
SampleCS222_Inet.txt:
Your program will generate a report listing all computers fromthe same locality---that is, each computer with matchingvalues in the first two components of the address. In the list, the computers should be
identified by their alias. The report will be saved to file
“222_Locality_Report”.As with HW3, the report will contain the user’s
name and current date, along with the generated reportlisting.
Examples: Hal GreenwaldOct 22,2020
CS222NetworkLocality Report
111.22
PLATTE
GREEN
131.250
JET
BAKER
172.66
WABASH
111.22.3.44 PLATTE
131.250.95.21 JET
172.66.7.88 WABASH
111.22.5.66 GREEN
131.250.47.63 BAKER
0.0.0.0 NONE
For this assignment, you will
create your own test data files
using the sample format. Grading
will involve using different data
files with the same format.
Programstructure and design:
Create a structure typecalled:
struct address_t
with componentsfor thefour integers of an IPv4 address alongwith a
fifth componentin which to store an associatedalias of up to 10
characters.
You will then declare an array of 100 address_tstructures in which to
store the data read in from “CS222_Inet.txt”.For this exercise you may
have 2 global variablesonly:
struct address_t addressArray[100];
FILE *outputReport
Includeat least the following UDFs (You may define your own prototypes):
a) readDataFile (Note: you may assume that the data file is syntacticallycorrect.)
b) generateLocalityRpt
c) getDateAndTime (sameas HW3)
Rubric 10 points:
• Is the source code well documented and formatted using clearly readable
indentation and white space (while viewed within vi)? 1 point
• Is struct address_t addressArray[100] properly implemented? 1 point
• Are the 3 UDFs properly implemented? 2 points
• Did you limityour program to2 (or fewer) global variables? 2points
• Is the sentinel input loop properly implemented? 2 points
• Is “222_Locality_Report” correct? 2 points
• Note:Your program must compile usinggcc in order toreceivecredit
Note: Other than prompting for the username, this project does not require an
interactive user interface.
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。