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

Solve for unknowns x and y from equations, Solve for unknowns 'x' and 'y' f...

Solve for unknowns 'x' and 'y' from Equations (1) and (2) using MATLAB. (However, if MATLAB is not the appropriate software to solve these two simultaneous equations, please sugges

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

Michael, Write a Matlab function that computes y1= tan(x) and y2= sin(x)/co...

Write a Matlab function that computes y1= tan(x) and y2= sin(x)/cos(x), returns the difference |y1–y2| and prints a message whether the two are equal or not. Test your function for

Matrices of random numbers, Matrices of random numbers: The Matrices o...

Matrices of random numbers: The Matrices of random numbers can be generated using the rand and randint functions. The first two arguments in the randint function identify the

Creating column vectors, Creating Column Vectors: One way to generate ...

Creating Column Vectors: One way to generate a column vector is by explicitly putting the values in square brackets, separated by the semicolons: >> c = [1; 2; 3; 4] c =

Program for add sinusoid with frequency, Job: Add sinusoid with frequency 1...

Job: Add sinusoid with frequency 1000 Hz and amplitude 100 to the one generated in Job 1 (: Create a function using mat lab to generate a sinusoidal signal. The parameters of the s

Function with float and integer, hi i have this programm function [IRN,num...

hi i have this programm function [IRN,number ] = randnumbers( IRN ) IRN=int32(IRN) ITOTAL=(IRN*330)+100 ITOTAL=int32(ITOTAL); IQUOTIENT=ITOTAL/2303 IQUOTIENT=int32(IQUOTIENT);

#GUI, #create a matlab GUI for designing common emitter amplifier which pro...

#create a matlab GUI for designing common emitter amplifier which produces AC load lines based on the component values

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