CS 1371 HW, MATLAB Programming

Assignment Help:
Function Name: voteCounter

Inputs (1): - (char) filename of votes

Outputs (0): - none

Function Description:

You use the brand new VoteMaster 3000 to tally up votes in the recent

elections of some of your extracurricular organizations. To your dismay,

it only outputs a txt file with a title describing the election and a

list of the candidates'' names, with each line representing a vote for

that candidate.

In addition to suing the VoteMaster 3000 makers for false advertising,

you now have to create a MATLAB function named voteCounter that takes in

the txt file of names and writes another txt file containing the

candidates and their respective votes, in descending order. Furthermore,

the filename of the written txt file should be the first line of the

input txt file.

For example, if the input txt file contained

1371 Head TA Elections

McGraw

Carter

Tahler

Bragg

Carter

your written txt file should be named ''1371 Head TA Elections.txt'' and contain

Carter 2

McGraw 1

Tahler 1

Bragg 1

Notes:

- in the written text file, there is a space between the candidate name

and his/her number of votes

- in the event of a tie, the candidate who appears first in the input

file wins (the sort function should take care of this)

- there should be no empty line at the end of your written file (i.e. the

last line of your written file should be the candidate who received the

least number of votes)

- PLEASE open the txt files in MATLAB to avoid confusion with new lines.

Related Discussions:- CS 1371 HW

Write a program to calculates the standard deviation, Write a program that ...

Write a program that reads in numbers (of type double) from a file, stores them in an array, and then calculates the mean, variance, and standard deviation.   Your program shoul

Quiz2, 2)''dbcont'' command for debugging is used to Select one: a. Cont...

2)''dbcont'' command for debugging is used to Select one: a. Continue normal code execution from the debug prompt. b. List all breakpoints. c. Execute (step) one or more lines

Illustration of a conditional loop, Illustration of a conditional loop - Wh...

Illustration of a conditional loop - While loop: As an illustration of a conditional loop, we will write a function which will find the first factorial which is greater than t

Variable number of input arguments - function, Variable number of input arg...

Variable number of input arguments: For illustration, the below function areafori has a variable number of input arguments, either the 1 or 2. The name of the function stands

Matrix, if i have a 3x2 double.. how can i run a for loop for this matrix s...

if i have a 3x2 double.. how can i run a for loop for this matrix so tht it can subtracted values of he adjacent neighbors?

Calculate the velocity of groundwater, The characteristic properties of an ...

The characteristic properties of an aquifer can be used to calculate groundwater velocities, v groundwater (L/T), according to: where KH (L/T) is the hydraulic conductivit

Plot the intensity distribution - numerical techniques, Using numerical tec...

Using numerical techniques, plot the intensity distribution for LP 01 and LP 11 modes. Vary the value of V (reduce it to 1.5) and plot several of the intensity plots (of LP 01 )

None, La proporción de empleados de una empresa que usan su auto para ir al...

La proporción de empleados de una empresa que usan su auto para ir al trabajo es 5:16. Si hay un total de 800 empleados

Speech recognition using support vector machine, what are data collect th...

what are data collect this topic,how i can create algorithm in mat lab what language support easy to this topic

#signals and systems, convolve the following sequences using tabulation met...

convolve the following sequences using tabulation method and verify the same using matrix mmethhod

Write Your Message!

Captcha
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