”
TCSS 380作业 辅导、 写作C++编程设计作业、 辅导C/C++实验作业、program留学生作业 写作
Program 2, TCSS 380 Autumn 2019
OBJECTIVE
The objective of this assignment is to apply your newly learned Erlang knowledge to build a program from scratch.
ASSIGNMENT DESCRIPTION
For this assignment you will rewrite the programming assignment you have done in C. All high-level program logic
remains the same. Since, however, now you are modelling this logic in Erlang, the following requirements must be
met:
Each directory entry / file in the program is to be modeled by a tuple that consists of a filename and its size
in bytes that will be entered by the user, and the number for the beginning block and the number of blocks
used by the file that will be generated by the program
The directory table should be modeled by a list
Each block in the program is to be modeled by a tuple that consists of a block number, how much of this
block is used and the amount of internal fragmentation
The block table should be modeled by a list
I/O: Since we havent discussed interactive input, examine the small sample functions below for interactive input
handling.
integer input handling:
input() –
S = io:get_line(Enter: ),
{Int,_} = string:to_integer(S),
io:fwrite(echo ~i ~n, [Int]),
case Int of
1 – input();
2 – input();
3 – input();
4 – done
end.
string input handling:
input() –
S = io:get_line(prompt: ),
{Strip,_} = lists:split(length(S)-1, S),
io:fwrite(echo ~s ~n, [Strip]),
case string:equal(Strip, quit) of
true – done;
_ – input()
end.
PROGRAM SPECS
Your program is to include the following functions (follow the naming conventions if you want your program to be
graded):
mymain() this function is similar in its logic to how main functions in C and Java, i.e. starts and drives the
program; the user will call this function from the shell in order to start the program
printMenu() prints the menu choices to the shell
blocksAsString( ListOfBlockTuples) given a list of tuples representing the blocks returns that list as a string
directoryAsString(ListOfFileTuples) given a list of tuples representing the files returns that list as a string
other functions you deem appropriate to achieve proper modularization
In addition, your program must fulfill the following requirements:
Only lists and tuples are to be used, no other data structures allowed
Your driver file should be called pr2.erl
Helper functions should NOT be listed in an export statement
Include comments the header with your name, program name, date; function headers that describe the
purpose of each function; code comments that describe the high-level logic
Your program is to be contained within one file called pr2.erl ; If you decide to use a multiple file structure,
you can call your other files according to your preference but function mymain must reside in pr2.erl
– 2 –
Your program has to follow basic stylistic guidelines, such as proper indentation (it is better to use
whitespaces to ensure thats the case), meaningful variable names, etc.
You are to save your shell with sample calls to your functions to a file called pr2_tests.erl
EXECUTIVE SUMMARY
You are to write an executive summary. It should be written as a txt file. In the file, describe what you have done to
complete the assignment in about 500 words and compare your C and Erlang approaches to this program. How has
programming paradigm affected your work/choices? Which one do you prefer and why? The word count is not
strict, so do not worry about going slightly over; however, summaries that are 400 words or are trivial in nature
(representing little thought or effort) will not get full credit.
EXTRA CREDIT
Extend the program in an interesting way or collect stats over multiple runs and add conclusions. If your extra credit
results in more code, then you need to submit four files for grading: pr2.erl that contains the assignment, the run of
the shell saved into pr2_tests.erl, pr2EC.erl that contains the assignment with extra credit, and the shell showing its
usage saved as pr2EC_tests.erl. At the top of pr2EC.erl explain what your extra credit is.
SUBMISSION AND GRADING NOTES
You are to submit your finished program through Canvas. This is an individual assignment you are NOT allowed to
work on it with any other student or share your code with others. The code will be graded based on its correctness
by running it on instructor/grader designed test cases. Then, the code will be looked over for anything that violates
good coding practices or the assignment specs (e.g. non-meaningful variable names, lack of code modularization).
Note that you may turn in this assignment 7 days late, with no penalty. However, no submission past this deadline
will be accepted even if you submit one minute after the deadlines timestamp 7 days of lateness is more than
enough.
Grading points will be distributed in the following fashion:
Running program
o Directory table operations 15 pts
o Block table operations 15 pts
Proper modularization 5 pts
Coding style and comments 5 pts
Shell saved as a file 5 pts
Executive summary 5 pts
Extra credit 5 pts
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。