Select a random student

From Computer Science Wiki
This a problem set for you to work through [1]

This is a problem set. Some of these are easy, others are far more difficult. The purpose of these problems sets are:

  1. to build your skill applying computational thinking to a problem
  2. to assess your knowledge and skills of different programming practices


What is this problem set trying to do[edit]

I am testing your current ability to think about a problem and solve it. There isn't a right or wrong here, just demonstrating what you know. In broad strokes, this problem set requires you to:

  1. REALLY understand the problem
  2. Think about how you might solve the problem
  3. Create a solution to the problem
  4. Test if your solution works (solves the problem)


The Problem[edit]

I teach 5 classes. I am interested in creating a system to randomly call on students in my classes. I would prefer not to call on the same student twice during one class. At the end of a class, I would like to know who I called and who I did not call on. Please reflect on your computational thinking skills & ask me questions which will help you design this system.

The input[edit]

The input will be five different buttons which represent each of my five classes. For example:

  • Class 1
  • Class 2
  • Class 3
  • Class 4
  • Class 5

The output[edit]

The output of this program will be:

  1. the first name of a student from a class, randomly selected. I will provide you with a list of first names for my students.
  2. you should store the students you have called in a list (even though for now, you will only select only one).

A possible solution[edit]

Click the expand link to see one possible solution, but NOT before you have tried and failed!

<!-- the file below should be named random.html there is another file, below.-->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Choose a random student</title>
</head>
<body>
<form action="random.php" method="post">

    <fieldset>
        <legend>Select a class</legend>

        <input type="radio" id="classes" name="block" value="1">Block 1<br>
        <input type="radio" id="classes" name="block" value="2">Block 2<br>
        <input type="radio" id="classes" name="block" value="4">Block 4<br>
        <input type="radio" id="classes" name="block" value="5">Block 5<br>

        <button type="submit">Click here to select a student</button>
    </fieldset>

</form>
</body>
</html>

How you will be assessed[edit]

Your solution will be graded using the following axis:


Scope

  • To what extent does your code implement the features required by our specification?
  • To what extent is there evidence of effort?

Correctness

  • To what extent did your code meet specifications?
  • To what extent did your code meet unit tests?
  • To what extent is your code free of bugs?

Design

  • To what extent is your code written well (i.e. clearly, efficiently, elegantly, and/or logically)?
  • To what extent is your code eliminating repetition?
  • To what extent is your code using functions appropriately?

Style

  • To what extent is your code readable?
  • To what extent is your code commented?
  • To what extent are your variables well named?


References[edit]