0.5 First Day Assignment

Overview

Web Requests and Human Interpretation

In 0.3, you manually told the First Day application whether it was raining. In 0.5, you will use information from the Web before making that same decision.

You will enter a location, construct a weather request from that input, inspect the request URL, receive weather information from a server, and display a weather image. You will then use your own judgment to decide whether the image shows evidence of rain and set the existing It is raining checkbox yourself.

Most networking code is provided. Your focus is the path the information follows: user input → URL → request → response → displayed information → human interpretation → existing Boolean decision.

User Story

As a student preparing for the first day of class, I want to view weather information for a location and use my observation in the clothing decision so that I can see how information from the Web can influence an application.

Acceptance Criteria

Task List

  1. Get Started From Your 0.4 Solution
  2. Model the Web Request
  3. Add the Weather Controls
  4. Build and Inspect the Weather URLs
  5. Send the Request and Display the Response
  6. Interpret the Weather and Reuse the Clothing Decision
  7. Final Check and Submit
The Application Does Not Interpret the Weather Yet

The Web provides information. In this assignment, you decide whether the displayed information shows evidence of rain. The application still receives the final rain/no-rain value from the same checkbox you used in 0.3.

  1. 1. Back Up and Open Your Existing First Day Solution

    Your First Day solution was renamed to your last name in 0.2. Keep that working name for the rest of the sequence. At the beginning of each module, make a backup of the completed previous checkpoint, then continue working in the original student-named solution.

    Step 1 — Make a checkpoint backup

    One Working Name

    The backup identifies the completed checkpoint. The working solution remains named for you, so later First Day assignments continue in the same project without repeatedly renaming the solution.

    Step 2 — Verify the previous checkpoint

    1. Build or run the solution before making the new 0.5 changes
    2. Verify the major behavior you completed in 0.4 is still present
    3. If the previous checkpoint is not working, correct that starting state before adding the new module work
    Go to top
  2. 2. Model the Web Request

    Module 0.5 revisits UML activity diagrams. This time, activity partitions show which participant is responsible for each action.

    Step 1 — Read the request/response flow

    The student starts the request, the First Day application constructs it, and the weather server returns information. The application can display the response, but the human still decides what the weather information means.

    UML activity diagram with Student, First Day Application, and Weather Server partitions. The student enters a location and chooses Load Weather; the application encodes the location and constructs a weather request URL; the server receives the request and returns weather information; the application displays the text and image; the student inspects the result.
    A web interaction crosses responsibilities: student input, application request construction, server response, and application display.

    Step 2 — Identify the participants

    1. Identify the action performed by the student
    2. Identify the actions performed by the First Day application
    3. Identify the actions performed by the weather server
    4. Notice that the response travels back to the application before the student interprets it
    Client and Server

    For this walkthrough, the First Day application is acting as a client. It creates a request for a resource hosted by another system. That other system returns a response.

    Go to top
  3. 3. Add the Weather Controls

    The application needs a place for a location, a button to start the request, and an image area to display the graphical weather response.

    Step 1 — Open MainWindow.xaml

    1. Open FirstDayScenario/MainWindow.xaml
    2. Keep the existing 0.3 controls unchanged
    3. Keep the 0.4 shopping-list controls, but use the slightly shorter version supplied below to make room for the weather section
    Screenshot placeholder showing where the new weather controls belong below the shopping-list controls in MainWindow.xaml
    The weather section belongs below the existing shopping-list section.

    Step 2 — Make room for the weather section

    MainWindow.xaml — update the Window size
    <Window x:Class="FirstDayScenario.MainWindow" ... Title="MainWindow" Height="920" Width="500">

    Replace the current shopping-list StackPanel with the slightly shorter version below. The behavior stays the same; this only creates space for the new section.

    MainWindow.xaml — replace the 0.4 shopping-list StackPanel
    <StackPanel HorizontalAlignment="Center" Height="190" Margin="0,205,0,0" VerticalAlignment="Top" Width="360">
        <TextBlock Text="School Shopping List" FontWeight="Bold" Margin="5" />
        <TextBox x:Name="shoppingListTextBox" Height="105" Margin="5" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" />
        <Button x:Name="saveShoppingListButton" Content="Save Shopping List" Margin="5" Click="SaveShoppingListButton_Click" />
    </StackPanel>

    Step 3 — Add the supplied weather controls

    Place this StackPanel after the shopping-list StackPanel and before textOutput.

    MainWindow.xaml — add this weather StackPanel
    <StackPanel HorizontalAlignment="Center" Height="390" Margin="0,400,0,0" VerticalAlignment="Top" Width="420">
        <TextBlock Text="Weather" FontWeight="Bold" Margin="5" />
        <TextBox x:Name="weatherLocationTextBox" Width="360" Margin="5" ToolTip="Enter a location such as Wausau WI" />
        <Button x:Name="loadWeatherButton" Content="Load Weather" Width="360" Margin="5" Click="LoadWeatherButton_Click" />
        <Image x:Name="weatherImage" Width="400" Height="285" Margin="5" Stretch="Uniform" />
    </StackPanel>

    Replace the existing textOutput line with the version below.

    MainWindow.xaml — replace the textOutput line
    <TextBox x:Name="textOutput" HorizontalAlignment="Center" Height="90" Margin="0,795,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="420" BorderThickness="3" BorderBrush="#FFB3B3B4" VerticalScrollBarVisibility="Auto" />

    Check Your Work

    1. Build the solution
    2. Run the application
    3. Verify the earlier controls still appear
    4. Verify the new Weather section contains a location box, Load Weather button, and empty image area
    Screenshot placeholder showing the running First Day application with the new location, Load Weather, and weather-image controls
    The new controls provide the input and display surfaces for the web request.
    Go to top
  4. 4. Build and Inspect the Weather URLs

    A URL identifies a resource on the Web. The application builds one URL for a compact text response and one for a graphical weather image.

    Step 1 — Add the supplied WeatherSupport file

    1. Download WeatherSupport.cs
    2. Add it to the FirstDayScenario project as an existing item
    3. Do not edit the helper
    Built-In Service Fallback

    The helper uses the live weather service when it is available. If the service cannot be reached, it supplies one of several bundled course weather images and clearly labels the result as a sample. You do not need to troubleshoot or understand the fallback implementation.

    Step 2 — Build the two URLs

    MainWindow.xaml.cs — URL construction
    string location = Uri.EscapeDataString(this.weatherLocationTextBox.Text);
    string weatherRequestUrl = "https://wttr.in/" + location + "?format=3";
    string weatherImageUrl = "https://wttr.in/" + location + ".png";

    Step 3 — Inspect the request URL

    1. Set a breakpoint on the line that calls WeatherSupport.Load
    2. Run the application and enter Wausau WI
    3. Click Load Weather
    4. Inspect weatherRequestUrl
    5. Identify the scheme, host, location path, and format=3 query parameter
    Screenshot placeholder showing weatherRequestUrl immediately before WeatherSupport.Load is called
    Inspect the URL before the helper obtains the live response or selects an offline course sample.
    Go to top
  5. 5. Request and Display the Weather Information

    The supplied helper uses the URLs you constructed. Live information is displayed when the service responds. A clearly labeled course sample is displayed when it does not.

    Step 1 — Keep the displayed image available for later use

    Add these fields inside MainWindow near the existing fields:

    MainWindow.xaml.cs — current weather-image state
    private byte[] currentWeatherImageBytes;
    private string currentWeatherImageMediaType;
    private bool currentWeatherIsSample;

    Step 2 — Use the supplied request/display path

    LoadWeatherButton_Click — supplied helper call
    WeatherDisplayResult weatherResult = WeatherSupport.Load(weatherRequestUrl, weatherImageUrl);
    
    this.currentWeatherImageBytes = weatherResult.ImageBytes;
    this.currentWeatherImageMediaType = weatherResult.ImageMediaType;
    this.currentWeatherIsSample = weatherResult.IsSample;
    this.weatherImage.Source = WeatherSupport.CreateBitmap(weatherResult.ImageBytes);
    this.textOutput.Text = weatherResult.DisplayText;

    Step 3 — Observe the result

    1. Continue from the breakpoint
    2. If the service responds, observe the live weather response and image
    3. If it does not, observe Live weather service unavailable. Sample weather image shown.
    4. In either case, keep the displayed image visible for the next task
    Screenshot placeholder showing either a live response or the clearly labeled sample-weather fallback
    The application distinguishes live information from the sample used during an external-service outage.
    Screenshot placeholder showing the weather image without an instructor-supplied rain or no-rain answer
    The helper ensures an image is available; the learner still interprets the image.
    Go to top
  6. 6. Interpret the Weather and Reuse the Clothing Decision

    The server returned weather information and the application displayed it. The next step belongs to you.

    Step 1 — Make the human interpretation

    1. Look at the displayed weather image
    2. Decide whether the image provides evidence that it is raining
    3. If you believe it is raining, check It is raining
    4. If you do not believe it is raining, leave the checkbox unchecked
    Do Not Let the Program Decide Yet

    In 0.5, the weather image is information for a person to interpret. The application does not automatically decide whether the picture means rain.

    Step 2 — Reuse the 0.3 clothing decision

    1. Set or keep the familiar breakpoint on if (isRaining) inside ChooseClothingButton_Click
    2. Click Choose Clothing
    3. At the breakpoint, inspect isRaining
    4. Verify the Boolean agrees with the checkbox state you selected
    5. Use F10 to follow the selected path
    6. Verify the displayed clothing recommendation matches the Boolean path
    Screenshot placeholder showing the existing clothing decision paused after the learner manually interpreted the weather image and set the rain checkbox
    Web information influenced the human decision; the human decision supplied the Boolean used by the existing program logic.

    Final Activity Diagram

    UML activity diagram with Student, First Day Application, and Weather Server partitions. The student enters a location; the application constructs and sends a web request; the server returns weather information and an image; the application displays them; the student interprets the image and checks or leaves unchecked It is raining; the application reads the checkbox and recommends a rain jacket when true or a hoodie when false; the student reviews the recommendation.
    Complete 0.5 flow: web information reaches the learner, the learner interprets it, and the existing Boolean decision uses that human judgment.

    Check Your Work

    1. Changing the location changes the constructed weather request
    2. The output shows the request and returned text
    3. The weather image is displayed from a web resource
    4. The application does not automatically change the rain checkbox
    5. The checkbox still controls the same Boolean decision introduced in 0.3
    Key Takeaway

    You have connected user input → URL → web request → response → displayed information → human interpretation → Boolean input → program decision.

    Go to top
  7. 7. Final Check and Submit

    Verify the complete 0.5 checkpoint before packaging the solution.

    Step 1 — Complete the final technical check

    Step 2 — Zip the solution

    1. Close Visual Studio
    2. Locate the LastName parent folder that contains the .sln file and project folder
    3. Create a ZIP file of the entire solution folder
    4. Open the ZIP and confirm the solution file, FirstDayScenario project folder, and WeatherSupport.cs are present

    Step 3 — Submit to the Feedback System

    1. Open the Feedback System
    2. Select the correct First Day 0.5 assignment
    3. Upload the zipped Visual Studio solution
    4. Review the Feedback System results and correct any in-scope issues if required
    5. Resubmit a corrected ZIP when needed

    Step 4 — Submit the Feedback System URL to Canvas

    1. After the required Feedback System submission is ready, copy its URL
    2. Open the correct 0.5 First Day Assignment in Canvas
    3. Submit the Feedback System URL as your Canvas submission
    Checkpoint Summary

    You constructed a web request from learner-supplied information, inspected its URL, observed the request/response flow, displayed both text and image resources returned through the Web, and then used human judgment to provide the Boolean input for the existing clothing decision.

    © 2026 Northcentral Technical College

    Go to top