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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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