Count up the number of times that both arrays

Assignment Help Data Structure & Algorithms
Reference no: EM13332439

What you need to do??
 
You must implement the following functions in "MCS2514Pgm1.cpp" to make the program work: 
string loadDatabase(string filename)
//Input: a filename as a string. This is the file from which to read data.
//Output: a string indicating a status: whether or not the file was loaded successfully.
 
Input files will have the following structure:
 
12
Joe Anyone 0 1 3 2 4 1 2 5 2 0 2
Sally Someone 2 1 4 2 4 2 3 4 6 1 2
...
...
 
First line is an integer indicates how many records are in the data file. The second line to the last line contains the records that are needed to load to the array of structs. Each line of the file will have someone's first name, last name, and NUMQUESTIONS integers (NUMQUESTIONS is a global constant declared in the file globals.h). You should read this data into an array of structs (the struct you defined should have three members:  one for first names, one for last names, and one is an integer array holding the answers for that person). 
 
bool isDatabaseLoaded()
//Input: none
//Output: a bool indicating whether a database has been loaded.
This function should return true if a database has been successfully loaded and false if one has not.
 
string getFirstName(int id)
//Input: an index into the array of structs
//Output: the first name of the student in the location indicated by id in the array of structs.
 
string getLastName(int id)
//Input: an index into the array of structs.
//Output: the last name of the student in that location of the array of structs.
 
int* getAnswerArray(int id)
//Input: an index into the array of structs.
//Output: array of integers containing the answers of the student in that location of the array of structs.
 
 
Please be careful about the array of structs and array of integers. For this function, it return the array that contains the answers of that person (that integer array is a member of the struct you defined).  
 int* can be used as the address of an integer or an integer array (address of the beginning of array). So, you can return an array to int*. Please search Wikepedia or Google int* for more information.
 
int compareAnswers(int answerArray1[], int answerArray2[])
//Input: two arrays of answers (array of size NUMQUESTIONS, type int)
//Output: integer ranking, interpreted as a "similarity metric" between the values in the two arrays.
 
void findTenBestMatches(int answerArray[], int returnArray[])
//INPUTS: 2 array of integers.(answerArray contains answers from GUI input)
//OUTPUT: you need to find out the index of 10 best matches.
Put these indexes in returnArray
 
A similarity metric gives a measure of the degree to which the two array (passed into the function as parameters) match. Here is how to implement this:
 
1. Count up the number of times that both arrays have the same integer value at the same index.
 
2. Examine the answer to the final question (value in the last position in the array, at index NUMQUESTIONS-

1). This indicates which question should be considered "most important."

Use this information to  weight  that question. If there is a match for that particular question, weight it with a factor of two. Normal question matches will have a weight of just one.

Reference no: EM13332439

Questions Cloud

T & corporate transformation course assignment : T & Corporate transformation course assignment:
What is a conceptual framework in accounting : What is a conceptual framework in accounting and how can the conceptual framework help users and preparers understand accounting requirements and financial statements?
Compressed video and data networks : Compressed Video and Data Networks
What is the volume flow rate through the pipe : A 1.0-cm diameter pipe widens to 2.0 cm and then narrows to 5.0 mm. Liquid flows through the first segment at a speed of 4.0 m/s. What is the volume flow rate through the pipe
Count up the number of times that both arrays : Count up the number of times that both arrays have the same integer value at the same index.
Search the web for steganographic tools : Search the Web for steganographic tools
Find is the final image upright or inverted : Two converging lenses (f1 = 9.00 cm and f2 = 6.00 cm) are separated by 18.0 cm. The lens on the left has the longer focal length. find is the final image upright or inverted
Define the nernst equation : Introduction to the Nernst Equation Learning Goal: To learn how to use the Nernst equation. The standard reduction potentials listed in any reference table are only valid at standard-state conditions of 25 circ C and 1 M. To calculate the cell pot..
Explain characteristics of the titration curve : These are characteristics of the titration curve for 25.0 mL of 0.400 M NH3(aq) titrated with 0.335 M HI(aq). (For NH3, Kb = 1.8x10-5.) (1a) The initial pH : (1b) The volume of HI(aq) required to reach the equivalence point : (1c) The pH at the ha..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Design and build a prototype data warehouse

Design and build a prototype data warehouse using the data on Spend over £500 in the Department of Energy and Climate Change for the financial year 2012-2013 (April 2012 to March 2013 inclusive).

  Pseudocode for divide-and-conquer algorithm

Write a pseudocode for a divide-and-conquer algorithm for finding the position of the largest element in an array of n numbers.

  Write down the algorithm to insert an item

Write down the sample code to create a Linked List and allocate storage space for a node Write down the algorithm to insert an item At the beginning of a linked list

  Explain two possible solution-fill in blank squares by words

The objective is to fill in blank squares using words from the list. Your task is to formulate problem as constraint satisfaction problem. Explain two possible solutions.

  Create a java program to arithmetic expression

Create a Java program that takes as input an infix arithmetic expression then transforms to a postfix expression and based on binary tree, it evaluates that expression.

  Let t be the degree of a btree

Let t be the degree of a BTree. Suppose the size of each object, including the key, stored in the tree is 90 bytes. Also, suppose the size of a BTreeNode pointer is 4 bytes.

  Implementing ajax programming

In the AJAX scripts construct, refer to the DSN datasource as flamingo. Even though its not in your own folder or directory, it has been set up as SYSTEM DSN, so your AJAX script will have access to it.

  Difference between workbook and worksheet

Discuss the difference between a workbook and a worksheet and explain why would you want to use individual worksheets when using Excel?

  Write a breadth-?rst search algorithm

Write an algorithm to classify the edges of a directed graph G into the four categories: tree edge, back edge, forward edge and cross edge (de?ned in De?nition 7.14, pages 342-343).

  Develop the pseudo code need

Develop the pseudo code needed to find the average of ten 8-bit numbers. Use a loop.

  Entity relationship diagrams

Discuss why are Entity Relationship Diagrams an important initial stage in developing databases? Who would be the initial parties interacting to develop the ERDs?

  Write a procedure hamming

Write a procedure hamming(ascii, encoded) that converts the low-order 7 bits of ascii into an 11-bit integer codeword stored in encoded.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd