Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Visual C# ONLY!! Here is the Problem! Attached, you will find a database file na

ID: 3579211 • Letter: V

Question

Visual C# ONLY!!

Here is the Problem!

Attached, you will find a database file named PopulationDB.mdf*. The database has a table named City. The City table has the following columns:

The City column stores the name of a city and the Population column stores the population of that city. The database has 20 rows already entered.

Create an application that connects to the PopulationDB.mdf database and allows the user to perform the following:

Use data-bound controls to add new rows to the database, change existing rows, and delete rows.

Sort the list of cities by population, in ascending order.

Sort the list of cities by population, in descending order.

Sort the list of cities by name.

Get the total population of all the cities.

Get the average population of all the cities.

Get the highest population.

Get the lowest population.

Here is all of my codes that i write ...

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;

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

private void cityBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.cityBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.populationDataSet);

}

private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'populationDataSet.City' table. You can move, or remove it, as needed.
this.cityTableAdapter.Fill(this.populationDataSet.City);

}
// Sort the table by population in ascending order
private void Ascpopulationbutton_Click(object sender, EventArgs e)
{
this.cityTableAdapter.FillByPopulation(this.populationDataSet.City);

}
// Sort the table by population in descending order

private void DescPopulationbutton_Click(object sender, EventArgs e)
{
this.cityTableAdapter.FillByPopulationdes(this.populationDataSet.City);

}

private void Namebutton_Click(object sender, EventArgs e)
{
this.cityTableAdapter.FillByName(this.populationDataSet.City);
}

private void Totalbutton_Click(object sender, EventArgs e)
{
// Declare variable to hold total population.
double totalPopulation;

//Get the total population

totalPopulation = (double)this.cityTableAdapter.TotalPopulation();

// Display the total population.
MessageBox.Show("Total Population:" + totalPopulation.ToString("nO"));

}

private void Averagebutton_Click(object sender, EventArgs e)
{
// Declare variable to hold average population.
double averagePopulation;

// Get the average population
averagePopulation = (double)this.cityTableAdapter.AveragePopulation();

// Display the average population.
MessageBox.Show("Average Population:" + averagePopulation.ToString("nO"));
}

private void Maxpopulationbutton_Click(object sender, EventArgs e)
{
// Declare variable to hold highest population.
double maxPopulation;

// Get the highest population
maxPopulation = (double)this.cityTableAdapter.MaxPopulation();

// Display the highest population.
MessageBox.Show("Highest Population:" + maxPopulation.ToString("nO"));

}

private void Minpopulationbutton_Click(object sender, EventArgs e)
{
// Declare variable to hold lowest population.
double minPopulation;

// Get the lowest population.
minPopulation = (double)this.cityTableAdapter.MinPopulation();

// Display the lowest population.
MessageBox.Show("Lowest Population:" + minPopulation.ToString("nO"));

}

private void Exitbutton_Click(object sender, EventArgs e)
{
// close the form.
this.Close();
}
}
}

The issues that im having is im getting errors im not sure why. Can you please help me find why im getting error.

Here is the Picture

Column Name Data Type City nvarchar(50) Primary key Population float 59 61 62 63 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 85 86 87 88 89 90 91 92 totalPopulation double) cityTableAdapter TotalPopulation this Display the total population. Message Box Sh ("Total Population totalPopulation.ToString ("no")) private void Averagebutton click (object sen EventArgs e) Declare variable to hold average population double average Population; Get the average population l average Population double) eragePopulation this Display the average population. Message Box Show erage Population averagePopulation. ToString ("no")) private void Maxpopulationbutton click (object sen EventArgs e) Declare variable to hold highest population. double maxPopulation; Get the highest population max Population this city Table Adapter axPopulation double) Display the highest population. Message Box Show ("Hi Population maxPopulation.ToString ("no")) ighest

Explanation / Answer

Red underline denotes that you are having some issue in your code.

I inspected the code you pasted here and I can say that

1) Totalpopulation() function has not been implemented

2) Averagefunction() has not been implemented

3) Max Function() has not been implemented