ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 23 May 2017 My Price 11.00

using System.Collections.Generic

It is for my Intro to Computer Programming Class.  I have written the code for the highest, lowest, and average scores. I cant figure out how to write the code for median and standard deviation. I know how to calculate them on pen and paper but writing a code for them is difficult for me.  I have provided a copy of what I have so far.Please help.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace Final_Project
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private double Total(double[]dArray)
{
double total = 0;
double finaltotal;

for (int index = 0; index {
total += dArray[index];
}

return total;
}

private double Average(double[]dArray)
{
double total = 0;
double average;

for (int index = 0; index {
total += dArray[index];
}

average = total / dArray.Length;
return average;
}

private double Highest(double[]dArray)
{
double highest = dArray[0];
for (int index = 1; index {
if (dArray[index] > highest)
{
highest = dArray[index];
}
}
return highest; 
}

private double Lowest(double[]dArray)
{
double lowest = dArray[0];
for (int index = 1; index {
if (dArray[index] {
lowest = dArray[index];
}
}

return lowest;
}

private void buttonGetScores_Click(object sender, EventArgs e)
{
try
{
const int size = 11;
double[] scores = new double[size];

int index = 0;
double highestScores;
double lowestScores;
double averageScores;
double totalScores;
StreamReader inputFile;

inputFile = File.OpenText("Testscores.txt");

while (!inputFile.EndOfStream && index {
scores[index] = int.Parse(inputFile.ReadLine());
index++;
}

inputFile.Close();

foreach (int value in scores)
{
listBoxScores.Items.Add(value);
}

highestScores = Highest(scores);
lowestScores = Lowest(scores);
averageScores = Average(scores);
totalScores = Total(scores);

labelHigh.Text = highestScores.ToString();
labelLow.Text = lowestScores.ToString();
labelAvg.Text = averageScores.ToString("n1");
}
catch (Exception ex)
{
MessageBox.Show("Invalid Number");
}
}

private void buttonExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

 

 

 

 

Final Project Create an application that reads a file called Test Scores.txt with 11 scores. Place the data in an
array or list and display the content of the array or list in a listbox.
Write methods that accept an array or list and returns lowest score, highest score, median score,
average score and the standard deviation of the scores.
Using the methods you created calculate the lowest score, highest score, median score, average
score and the standard deviation of the scores. Display those values in the appropriate labels.
Note: the median is calculated differently if your data is odd or even. Ensure that your method
can handle an even or odd number of data items.

Attachments:

Answers

(11)
Status NEW Posted 23 May 2017 06:05 AM My Price 11.00

-----------

Attachments

file 1495521773-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)