讲解:TCSS 380、C++、C/C++、programR|Database

Program 2, TCSS 380 Autumn 2019OBJECTIVEThe objective of this assignment is to apply your newly learned Erlang knowledge to build a program from scratch.ASSIGNMENT DESCRIPTIONFor this assignment you will rewrite the programming assignment you have done in C. All high-level program logicremains the same. Since, however, now you are modelling this logic in Erlang, the following requirements must bemet:? Each directory entry / file in the program is to be modeled by a tuple that consists of a filename and its sizein bytes that will be entered by the user, and the number for the beginning block and the number of blocksused 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 thisblock is used and the amount of internal fragmentation? The block table should be modeled by a listI/O: Since we haven’t discussed interactive input, examine the small sample functions below for interactive inputhandling.integer input handling:input() -> S = io:get_line(Enter: ), {Int,_} = string:to_integer(S), io:fwrite(echo ~i ~n, [Int]), case Int of1 -> 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) oftrue -> done;_ -> input() end.PROGRAM SPECSYour program is to include the following functions (follow the naming conventions if you want your program to begraded):? mymain() this function is similar in its logic to how main functions in C and Java, i.e. starts and drives theprogram; 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 modularizationIn 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 thepurpose oTCSS 380代写、代做C++编程设计、代写C/C++、pf 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 usewhitespaces to ensure that’s the case), meaningful variable names, etc.? You are to save your shell with sample calls to your functions to a file called pr2_tests.erlEXECUTIVE SUMMARYYou are to write an executive summary. It should be written as a txt file. In the file, describe what you have done tocomplete the assignment in about 500 words and compare your C and Erlang approaches to this program. How hasprogramming paradigm affected your work/choices? Which one do you prefer and why? The word count is notstrict, so do not worry about going slightly over; however, summaries that are (representing little thought or effort) will not get full credit.EXTRA CREDITExtend the program in an interesting way or collect stats over multiple runs and add conclusions. If your extra creditresults in more code, then you need to submit four files for grading: pr2.erl that contains the assignment, the run ofthe shell saved into pr2_tests.erl, pr2EC.erl that contains the assignment with extra credit, and the shell showing itsusage saved as pr2EC_tests.erl. At the top of pr2EC.erl explain what your extra credit is.SUBMISSION AND GRADING NOTESYou are to submit your finished program through Canvas. This is an individual assignment – you are NOT allowed towork on it with any other student or share your code with others. The code will be graded based on its correctnessby running it on instructor/grader designed test cases. Then, the code will be looked over for anything that violatesgood 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 deadlinewill be accepted even if you submit one minute after the deadline’s timestamp – 7 days of lateness is more thanenough.Grading points will be distributed in the following fashion:? Running programo Directory table operations 15 ptso 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转自:http://www.6daixie.com/contents/13/4431.html