QUESTION plz help me ....C++--------ADT

[b][red]This message was edited by coolbuddy at 2006-9-6 21:36:59[/red][/b][hr]
[b][red]This message was edited by coolbuddy at 2006-9-6 21:36:38[/red][/b][hr]
Hi , can u help me out with the algorithm for this program??
Thanks a lot man...
Plagiarism Detection


The output from Moss-PLAGERISM CHECKER will have one line for each program file received stating its highest similarity with other programs:
File1-123(71%) File2-123(63%) 177

The above line states that the file named File1 has 71% of its code similar to 63% of the code of File2, with total number of lines similar is 177 lines. 123 indicates that this is the record number 123 of the report. There are as many lines as the number of program files received by Moss. The general format of each line is:

File?-rec#(p1%) File?- rec# (p2%) nline

where ? can be any digit, rec# is the record number running from 0, p1 is the first percentage and p2 the second percentage, and nline is the number of lines similar.

The Problem:
In this exercise, you are required to write a program to read in from cin all lines of the report, extract the information needed for computation and write to cout the required statistics.

Since this exercise is on the design of an ADT, you should solve this problem by thinking about what will be the appropriate ADT used to provide the various functions needed. In particular, you are required to develop 3 files, assuming that the ADT is called Moss:
1. Moss.h // the header file
2. Moss.cpp // the implementation file
3. useMoss.cpp // The file containing the main() that will handle the input, calling various functions implemented, and output the required information.

We emphasize on the correct design of the ADT. If the design is not satisfactory, you will not get high score from your tutor when your program is marked manually, even though you may be given full score by CM.

Sample Input:
File 1 File 2 Lines Matched
File1-0(71%) File2-0(63%) 177
File1-1(59%) File2-1(63%) 167
File1-2(49%) File2-2(54%) 101
File1-3(42%) File2-3(51%) 130
File1-4(53%) File2-4(47%) 92
File1-5(58%) File2-5(57%) 109
File1-6(43%) File2-6(48%) 183
File1-7(48%) File2-7(50%) 80
File1-8(38%) File2-8(45%) 81
File1-9(40%) File2-9(41%) 71
File1-10(38%) File2-10(32%) 64
File1-11(17%) File2-11(29%) 61
File1-12(28%) File2-12(26%) 65
File1-13(22%) File2-13(18%) 50
File1-14(13%) File2-14(11%) 20
File1-15(16%) File2-15(14%) 28
File1-16(17%) File2-16(16%) 34
File1-17(14%) File2-17(13%) 23
File1-18(14%) File2-18(10%) 41

Sample Output:
number of records: 19
maxp1 = 71 minp1 = 13 avgp1 = 35 stdevp1 = 19
maxp2 = 63 minp2 = 10 avgp2 = 36 stdevp2 = 19
maxnline = 183 minnline = 20 avgnline = 83 stdevnline = 50

Explanation of the output:
The statistics tells us that there are 19 records, the maximum p1 is 71%, minimum p1 13%, average p1 35%, and the standard deviation of p1 is 19%. The next line is for p2 and the last line is for the number of lines found similar.

Note:
* STDEV uses the following formula:
* sqrt((sum of the square of each term – n *square of mean )/(n-1))

Notice that it is hard for exact match of real number by CM. That is why we have shown avgp1, avgp2 and avgnline in integer. They should be in int internally, so that when you use the simplified formula to compute the stdev, the compute of square is done in double, the mean used is in int, sqrt in double, and the end result will be converted into int.

PLease provide me the solution,greatly appreciated.




Comments

  • : Hi Stober , can u help me out with the algorithm for this program??
    : Thanks a lot man...
    : Plagiarism Detection
    :
    : Any number (at least 1) of programs submitted to the CourseMarker (CM) are sent to Moss for plagiarism checking. The result of such checking will be returned in a text file. The figures in the file will be used to decide what level of similarity between programs is considered too high for programs that are truly written independently by individuals.
    :
    : What is Moss?
    : Moss (Measure Of Software Similarity) is an automatic system for determining the similarity of C, C++, Java, Pascal, Ada, ML, Lisp, or Scheme programs. To date, the main application of Moss has been in detecting plagiarism in programming classes. Since its development in 1994, Moss has been very effective in this role. The algorithm behind moss is a significant improvement over other cheating detection algorithms (at least, over those known to us).
    :
    : The output from Moss will have one line for each program file received stating its highest similarity with other programs:
    : File1-123(71%) File2-123(63%) 177
    :
    : The above line states that the file named File1 has 71% of its code similar to 63% of the code of File2, with total number of lines similar is 177 lines. 123 indicates that this is the record number 123 of the report. There are as many lines as the number of program files received by Moss. The general format of each line is:
    :
    : File?-rec#(p1%) File?- rec# (p2%) nline
    :
    : where ? can be any digit, rec# is the record number running from 0, p1 is the first percentage and p2 the second percentage, and nline is the number of lines similar.
    :
    : The Problem:
    : In this exercise, you are required to write a program to read in from cin all lines of the report, extract the information needed for computation and write to cout the required statistics.
    :
    : Since this exercise is on the design of an ADT, you should solve this problem by thinking about what will be the appropriate ADT used to provide the various functions needed. In particular, you are required to develop 3 files, assuming that the ADT is called Moss:
    : 1. Moss.h // the header file
    : 2. Moss.cpp // the implementation file
    : 3. useMoss.cpp // The file containing the main() that will handle the input, calling various functions implemented, and output the required information.
    :
    : We emphasize on the correct design of the ADT. If the design is not satisfactory, you will not get high score from your tutor when your program is marked manually, even though you may be given full score by CM.
    :
    : Sample Input:
    : File 1 File 2 Lines Matched
    : File1-0(71%) File2-0(63%) 177
    : File1-1(59%) File2-1(63%) 167
    : File1-2(49%) File2-2(54%) 101
    : File1-3(42%) File2-3(51%) 130
    : File1-4(53%) File2-4(47%) 92
    : File1-5(58%) File2-5(57%) 109
    : File1-6(43%) File2-6(48%) 183
    : File1-7(48%) File2-7(50%) 80
    : File1-8(38%) File2-8(45%) 81
    : File1-9(40%) File2-9(41%) 71
    : File1-10(38%) File2-10(32%) 64
    : File1-11(17%) File2-11(29%) 61
    : File1-12(28%) File2-12(26%) 65
    : File1-13(22%) File2-13(18%) 50
    : File1-14(13%) File2-14(11%) 20
    : File1-15(16%) File2-15(14%) 28
    : File1-16(17%) File2-16(16%) 34
    : File1-17(14%) File2-17(13%) 23
    : File1-18(14%) File2-18(10%) 41
    :
    : Sample Output:
    : number of records: 19
    : maxp1 = 71 minp1 = 13 avgp1 = 35 stdevp1 = 19
    : maxp2 = 63 minp2 = 10 avgp2 = 36 stdevp2 = 19
    : maxnline = 183 minnline = 20 avgnline = 83 stdevnline = 50
    :
    : Explanation of the output:
    : The statistics tells us that there are 19 records, the maximum p1 is 71%, minimum p1 13%, average p1 35%, and the standard deviation of p1 is 19%. The next line is for p2 and the last line is for the number of lines found similar.
    :
    : Note:
    : * STDEV uses the following formula:
    : * sqrt((sum of the square of each term – n *square of mean )/(n-1))
    :
    : Notice that it is hard for exact match of real number by CM. That is why we have shown avgp1, avgp2 and avgnline in integer. They should be in int internally, so that when you use the simplified formula to compute the stdev, the compute of square is done in double, the mean used is in int, sqrt in double, and the end result will be converted into int.
    :
    : PLease provide me the solution,greatly appreciated.
    :



    I don't understand why you people keep bothering? We get 5-10 posts every week from people asking for us to do their homework. -None- of them has ever got the homework done that way. So what makes you think that you are an exception?
  • [b][red]This message was edited by stober at 2006-9-6 4:33:25[/red][/b][hr]
    That is just toooo much reading for me.:-) Now back to my pizza and beer.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories