program

0 comments

java and C++

 

{

 

 

1.

ORIGINAL REQUIREMENTS:

Develop a software application that will do the following:

 Allow user to enter a file name, either by command line, prompt, or menu.

 Open specified file. If multiple files are specified or a directory is specified (not required, but a nice optional feature), the program operates on each file in sequence.

 For Each File:

“Advanced” software developers: read each line in the file into a linked-list with one line in each “node” of the list.

 Count the total number of Lines of Code, “LOC”, contained in the file.

 Report the name of the file.

 Report the total number of LOC contained in the file.

 Close the input file.

 

ADDITIONAL NEW/CHANGED REQUIREMENTS – Add the following functionality to a new function – countFuncLOC();:

Count the Function LOC:

 Count the number of LOC contained in each function in the file.

 For each function in the file:

 Report the name of the function.

 Report the number of LOC contained in the function.

 

The main program performs the following operations:

 Prompt the user for file name input

 Open the file

 Invoke the Function LOC counting function

 Report of the File Name and file LOC count, each function name and the corresponding function LOC

 Close the file

 

BOTH the Function LOC and File LOC counting functionality shall be performed by a function called “countFuncLOC”. countFuncLOC receives a pointer to a valid open file and a pointer to a table for function data as passed parameters, and returns the integer number of LOC in the file.

The associated C prototype is as follows:

int countFuncLOC (FILE *filePointer, FUNCDATA *funcDataPtr); /* C-language function prototype */

int countFuncLOC (ifstream &file, FUNCDATA *funcDataPtr); // C++ function prototype

countFuncLOC may invoke the countLOC function if convenient. Otherwise, countFuncLOC will “absorb” the countLOC functionality.

The Function LOC data shall be stored in a table defined in the main program and accessed by countFuncLOC() through a pointer to the table.

All user interface shall be performed by the main program; countFuncLOC shall have no direct user interface.

The program shall be written in  C++ or Java.

An appropriate “typedef” should be used to define a data type for the Function LOC data, such as:

typedef struct

{

int funcLOC;

char funcName[MAX_NAME_SIZE]; /* See note below… */

} FUNCDATA;

* Note regarding funcName[] array: it is acceptable to define a constant array size with a “reasonable” MAX size for the function name (20 to 30 characters for a function name SHOULD be sufficient…)

IF YOU PREFER, you may use a pointer to a string in the FUNCDATA structure and use dynamic memory allocation as needed rather than a fixed function name length.

The table for the Function LOC data can be a fixed array as follows:

FUNCDATA funcDataTable[MAX_FUNCTIONS]; /* See note below… */

* Note regarding funcDataTable[] array: it is acceptable to define a constant array size with a “reasonable” MAX size for the number of functions in a file (10 to 20 functions in a file SHOULD be sufficient…)

IF YOU PREFER, you may use dynamic memory allocation as needed rather than a fixed data table size.

Additional Information:

A “Line of Code”, LOC, is defined for our exercise as a non-blank, non-comment line. A line containing any printable (i.e.: non-“white space” character such as space, tab, etc.) that is NOT in a comment is counted as LOC.

A comment in C/C++-language begins with either “//” or “/*”. A line comment beginning with “//” ends at the end of the line. A block comment beginning with “/*” ends with “*/”.

* A block comment may begin on a line that is also counted as LOC.

* A block comment may span more than one line.

A function in C-language has the basic form:

optional_additional_modifiers function_return_type function_name (type argument, additional arguments )

{

function body

}

example:

signed int loc_counter ( file * fileptr)

{

body …

}

The first line (‘signed int loc_counter (…)’ in the example above) and opening brace (if it is on a line by itself, as in the example above) in the function definition DO COUNT as Function LOC.

Note that the program must not mistake a function prototype as the beginning of the function itself:

function_return_type optional_additional_modifiers function_name (type argument, additional arguments );

The program is not a compiler and does not need to recognize valid lines of code in a particular programming language. MCS 5103 – Software Engineering February 3, 2015 Software_Development_Assignment_2_201502.Docx

Page 3 of 4

 

Process Requirements:

BEFORE YOU BEGIN:

Estimate the TOTAL time (actual working time in hours or minutes, not “calendar” time) that it will take you to complete the project (from the time you begin this estimation until you have a complete, properly functioning program.)

Estimate the total number of lines of code (LOC) of your completed program.

 Use the PSP3 project template in Process Dashboard to facilitate iterative/incremental development cycles.

 

AS YOU WORK:

Log the ACTUAL time (actual working time, not “calendar” time) that you spend working on the project INCLUDING:

 Analysis

 Design

 Coding

 COMPILING

 Testing

 Project Retrospective Analysis: Any POST project analysis, wrap-up, documentation, etc.

 

Log any defects that you encounter as you proceed INCLUDING (but not limited to):

 Incomplete, incorrect or missing requirements

 Incorrect design

 Logic errors

 Typo’s and syntax errors in source code

 

WHEN YOU’RE DONE:

Record the ACTUAL time it took to develop the program.

Record the ACTUAL number of LOC in the program.

Analyze/Summarize your experience (“Retrospective Analysis”):

 Analysis of Estimates vs. Actual (Time and LOC)

 What went right

 What went wrong

 

 

 

 

 

*Note that if separate documents are submitted for these specifications, the Report should contain references to these documents. ALL documents submitted should contain author identification and should indicate to what assignment they pertain.

Software:

 Source code

 Executable program (.exe, .jar)

 Software Project files (example: if MS Visual Studio is used, include the ENTIRE project folder containing all project files – such as .vcxproj. Note that the project files usually contain the source code and executable in the various subdirectories.)

 

Supporting Documentation:

 Time Log (Required)

 Defect Log (Required)

 Test Log (if used)

 

}

 

due to 3A.M

02122015

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}