Write a program that will perform the same operations twice

Assignment Help Data Structure & Algorithms
Reference no: EM131258436

Computer Science

Program- Write a program that will perform the same operations twice, once using an array of structs, and once using a pair of parallel arrays. The data will represent people's names and ages, so the first data structure will be an array of structs, each of which contains a string and an int, while the second will be separate arrays of strings and ints.

For both data structures, use functions to do the following tasks:

Open a user specified file for input. The file will contain a series of people's names and ages.

Get the data from the file and store it into the array space(s)

Search the array(s) for the position of the person with the greatest age, bring back the integer position value.

Output the name and age of the person with the highest age, along with a brief text message.

A main program might take the form of:

openFile
getParallelData
loc = searchParallel
outputParallel
openFile
getStructData
loc = searchStruct
outputStruct

The array sizes should all be 10, but your code should handle files that contain data for less than 10 people and files that contain data for more than 10 people.

The input files will take the form:

John J. Johnson
23
Sally Smith
19
. . .

The output should be something like this (showing the output from both parts):

John J. Johnson is the oldest at 23
John J. Johnson is the oldest at 23

Reference no: EM131258436

Questions Cloud

What is the efficiency of the assembly line : Draw the precedence diagram and assign tasks using five workstations. - What is the efficiency of the assembly line, using your answer to (a)?
Scarcity of resources apply to economic decisions : What are economic resources, and how does scarcity of resources apply to economic decisions? Think of a business firm you recently visited (such as Walmart, Home Depot, Red Lobster, Barnes & Noble, McDonald's, etc.).
What aspects of this action may shock the conscience : Identify the issues your partner has that relate to the exclusionary rule. What aspects of this action may shock the conscience of the court? What ensuing evidence found based on this operation may be discarded as "Fruit of the Poisonous Tree".
Determine the shear flow q in the crosssection : The cross-section is loaded by a torsion moment Mx. The material is linear elastic with shear modulus G. The cross-section is thin-walled with t « a.
Write a program that will perform the same operations twice : Write a program that will perform the same operations twice, once using an array of structs, and once using a pair of parallel arrays. The data will represent people's names and ages, so the first data structure will be an array of structs.
Problem regarding the anuual interest rate : Suppose John had not had to get a $10,000 loan at an anuual interest rate of 10% to buy equipment, but instead he had invested $10,000 of his own money in equipment.
Information on loan payments : How do you measure the value of the financial sector without information on loan payments?
Distinction between diplomatic and legislative immunity : Determine whether or not a conviction is feasible when an alleged perpetrator does not have the required mens rea but has engaged in the actus rea. Provide a rationale to support your position.
Cafe making an economic profit : John's annual accounting profit is $1750, he could earn $1,000 a year as a recycler of aluminum cans, however he prefers to pay $275/year to run the cafe rather than recyle, is the cafe making an economic profit?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explaining instruction format of operation code field

Operation code field, a mode field, to specify one of seven addressing modes, a register address field to specify one of 60 processor registers, and memory address. Specify instruction format and number of bits in each field if the instruction ..

  Exploring oop and its data structures

Exploring OOP and its Data Structures

  Question 1a explain the meaning of each of the following

question 1a explain the meaning of each of the following pointer declarations-i float a -0.137float pa ampaii double

  Explain solution to recurrence-appealing to recursion tree

Solve the following recurrence relations by the method of your choiceT(n) = 1 for n = 4 and T(n) =pnT(pn) + n for n > 4. Argue that the solution to the recurrence T(n) = T(n=3) + T(2n=3) + cn is (n lg n) by appealing to the recursion tree.

  What are the bivalent input configurations of the algorithm

Is a decision for v possible if exactly (N - t)/2 processes start the algorithm with input v? What are the bivalent input configurations of the algorithm?

  What is the worst case space complexity for the algorithm

What is the worst case space complexity for this algorithm (consider the array(s) B only)? Explain your reasoning. Give the O, ? and, if possible, T time complexities for this algorithm. Explain your reasoning.

  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).

  What are the potential benefits of knowledge management

What are the potential benefits of knowledge management projects

  Treat the problem as a directed graph with n nodes

Two distinct words can be joined if one, two or three of the letters at the end of the first word are the same as the letters at the beginning of the second word, and only if the letter/letters are in the same order.

  Plot the time complexity according to theoretical bounds.

Be sure to only include the time needed for sorted, excluding the time to generate the random numbers. Plot the results (input size, running time) for BubbleSort and MergeSort.

  Prove that there can be at most 13 distinct common entries

Tyrell-III has n replicants and each has a particular model specification. There are many models. Unfortunately, there was an insurgency on the planet and some of the replicants destroyed a critical database that held replicant data.

  Describe implementation of algorithm on simd computer

Describe an implementation of that algorithm on an SIMD computer where the processors are connected to form a linear array

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