CS 222讲解、辅导Python,JAVA,C++程序语言

- 首页 >> Python编程
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 of representation, the 32 bits composing the address may
be divided into four octets (bytes) written in decimal numbers, each
ranging from 0 to 255, and concatenated as a character string with a full
stop (ASCII 46) between each number.
For example:
The first two components of the address indicate the computer’s locality
on the network. In the above example, the locality is specified by the
numbers 172 and 16.
Another example:

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 and nicknames terminated by a sentinel address of
all zeros and the sentinel nickname, “NONE”.
Sample CS222_Inet.txt:
Your program will generate a report listing all computers from the same locality---that is, each computer with matching values 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 report listing.
Examples: Hal Greenwald Oct 22, 2020
CS222 Network Locality 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.
Program structure and design:
Create a structure type called:
struct address_t
with components for the four integers of an IPv4 address along with a
fifth component in which to store an associated alias of up to 10
characters.
You will then declare an array of 100 address_t structures in which to
store the data read in from “CS222_Inet.txt”. For this exercise you may
have 2 global variables only:
struct address_t addressArray[100];
FILE *outputReport
Include at least the following UDFs (You may define your own prototypes):
a) readDataFile (Note: you may assume that the data file is syntactically correct.)
b) generateLocalityRpt
c) getDateAndTime (same as 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 limit your program to 2 (or fewer) global variables? 2 points
• Is the sentinel input loop properly implemented? 2 points
• Is “222_Locality_Report” correct? 2 points
• Note: Your program must compile using gcc in order to receive credit
Note: Other than prompting for the user name, this project does not require an
interactive user interface.

站长地图