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

  Implementation of graph

Give the two input nodes after the graph has been built from the command prompt.

  Question related to bash script

Create a shell script to send a customized mail memo to the users listed on the command line through login name, only if they are currently logged on.

  Sort scheduling algorithms according to high throughput

Sort the scheduling algorithms (FCFS, SPF, RR, MLFB) according to each of High throughput (if we take averages of time intervals smaller than the sum of all processes' time)

  Design a representation of display screen

Create a form that lists possible potatoes and toppings in a manner that is easy for counter servers and kitchen crew to scan, and can also be used as input for the inventory reorder system.

  Portfolio planning using optimization

Set this problem up as a linear programming model in Excel, and use Solver to determine how the $10 million should be invested. What is the overall return (in dollars terms)

  Discuss and define normalization

Discuss and define normalization and what are the basic steps of the normalization process?

  Neural and tree learning on continuous attributes

Compare and contrast the methods of learning these numbers in the two models.

  Prepare a report about leased circuits

COMP6011 Data Communications -  Prepare a report about Leased circuits

  Explain the fifo structure of the queue

Explain the FIFO structure of the queue Explain how you would implement the queue data structure in its simplest form. Illustrate your answer fully with the necessary sample code

  High bandwidth network for the multimedia team

Assume you have been assigned to build a network for a multimedia development company that currently uses a 10-Mbps Ethernet network. The corporation requires a high bandwidth network for multimedia team.

  Discuss the issues involved in managing software selection

Prepare a PowerPoint presentation which summarizes the background, requirements, analysis and reasons for your choice. Alternative presentation formats such as Prezi are acceptable

  Professional codes of ethics

Select one of the Professional Codes of Ethics associated with IT. If you were to complete a assignment related to securing the connectivity in your firm and its business partners.

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