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;

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 10PE
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT