Data Collection Setup
Part of the Logic & Flow section of Coddy's C# journey — lesson 40 of 66.
Challenge
EasyIn this project, you'll build a data analysis system that processes student scores. First, create the foundation for collecting and validating input data.
Create a class called DataCollector with these methods:
CreateScoreGrid(int students, int assignments): Creates and returns a jagged array of integers (int[][]) with the specified dimensions to store student scores.ValidateScore(int score): Returns true if the score is valid (between 0 and 100 inclusive), otherwise false.PopulateWithDefaultValues(int[][] scoreGrid): Fills the entire grid with a default score of -1 (representing "not graded yet") and returns the updated grid.
IMPORTANT: Do not modify the test code at the bottom of the file. It will be used to validate your implementation.
Try it yourself
using System; // Don't delete this line
public class DataCollector
{
public static int[][] CreateScoreGrid(int students, int assignments)
{
// Write your code here
}
public static bool ValidateScore(int score)
{
// Write your code here
}
public static int[][] PopulateWithDefaultValues(int[][] scoreGrid)
{
// Write your code here
}
}All lessons in Logic & Flow
1Multi-dimensional Arrays
2D Arrays BasicsDeclaring and Initializing 2DAccessing 2D Array ElementsNested Loops with 2D ArraysJagged ArraysCommon Matrix OperationsRecap - Multi-dimensional4Flow Control Techniques
Early ReturnsGuard ClausesJump Statements (goto)Break and ContinueFlatten Nested Conditionals7Logical Operators Advanced
Short-Circuit EvaluationConditional Logical OperatorsOperator PrecedenceRecap - Advanced Operators2Advanced Decision Making
Multiple ConditionsComplex Boolean LogicIf vs. Switch ComparisonNested Switch StatementsRecap - Advanced Decisions5Exception Handling
Try-Catch BasicsException TypesMultiple Catch BlocksWorking with FilesFinally BlockUsing vs. Try-FinallyCustom ExceptionsRecap - Error Handling8Data Analysis System
Data Collection SetupData Entry Logic3Loop Enhancements
Loop PerformanceIterating ComplexEach Loop TypeRefactoring LoopsRecap - Optimized Loops6Null Handling
Null Reference BasicsNullable Value TypesNull Checking PatternsDefensive ProgrammingRecap - Null Safety