Using C# in visual studio help complete the TODOs: // TODO: comment Header // TODO: add regions to organize your code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using C# in visual studio help complete the TODOs:

// TODO: comment Header
// TODO: add regions to organize your code

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 ICE2_DiseaseCases
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

// Global Variables
Label[] weekDays;
TextBox[] infections;

// TODO: Add an event (ValueChanged) to the DateTimePicker control such that the weekday names are updated to match the chosen date. Note: the custom method to enter the names is already created, just call it.

private void Form1_Load(object sender, EventArgs e)
{
// initialize the weekdays label array and populate with the appropriate labels
weekDays = new Label[] { lblDay1, lblDay2, lblDay3, lblDay4, lblDay5, lblDay6, lblDay7 };

// TODO: initialize the infections textbox array and populate with the appropriate textboxes
  
// populate the week day name labels with the actual names.
SetDayNames();

// TODO: Create the method to set the form defaults called SetDefaults and uncomment out the line below. The date picker should default to the current date and the infection textboxes should be empty. review the SetDayNames() method for a hint how to do this.
// SetDefaults();
}


private void SetDayNames()
{
for (int day = 1; day <= 7; day++)
{
//TODO: review the below line to see if you can figure out how it works!
weekDays[day - 1].Text = (dtpStartingDate.Value.AddDays(day - 1)).DayOfWeek.ToString();
}
}

private void btnCalculate_Click(object sender, EventArgs e)
{
if (ValidateInfections())
{
//TODO: Using a loop, calculate the average
// Hint, int.Parse() should work as your validation should have already tested it using TryParse.

}
else
{
MessageBox.Show("Calculations can not be performed as one or more validations have failed");
}
  
}

private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void btnReset_Click(object sender, EventArgs e)
{
// TODO: Create the method to set the form defaults called SetDefaults and uncomment out the line below.
// SetDefaults();
}

private bool ValidateInfections()
{
bool retVal = true;
//TODO: complete this function such that if any of the infection textboxes are not numeric then validation fails. It is expected to do this in a modular way (i.e. looping, rather than using the textbox names.)

return retVal;
}
}
}

 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 16 images

Blurred answer
Knowledge Booster
Top down approach design
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education