CS 175/286 - Homework 2

Your task is to write an Android application that reads and displays quiz questions. Read the questions from this file The contents may change when your assignment is graded, but the format is the same. Each question is followed by n choices (not necessarily four), the correct choice having a *. A blank line or (for the last question) the end of the stream follows.

In the first screen, show a list of all questions. It is ok if they get truncated with a ...

When a user selects a question, show a list of all choices.

When a user selects a choice, tell the user whether they did it right or not.

Have a button "Back" in that screen that returns to the first list (not the second).

Your solution should have a class Quiz and a class Question. Each of these classes should have a method void read(Scanner in).

You check in a project that solves the assignment together with a report in a file report.txt. Use plain text, not Word or RTF, or you won't get credit for the report. Make sure that report.txt and report.png are in the hw02 directory inside your repo.

In the report, answer the questions given in the step-by-step instructions below.

  1. Make a new project with application and project name Homework02 in the package edu.sjsu.cs175.hw02.
  2. First write the code for reading the input. Explain in your report what challenges you faced with parsing the input. (It's not trivial to figure out whether to read another question in Quiz.read, so I am sure you'll have something to write about.)
  3. Commit your code after your read methods work. It's a good idea to test these outside Android, with a trivial Java SE test program. If you did that, tell me in your report.
  4. Then show the list of question texts. When a user taps a question, forward a serialized copy to the next intent, like in the lab. That intent shows a list with the questions.
  5. (a) You em must use an new AsyncTask<String, Void, Quiz> (b) Your list adapter should be an ArrayAdapter<Question>, not an ArrayAdapter<String>. (c) You should pass a Question object, not the Quiz object, into the intent for showing an individual question.
  6. Finish up by handling the question, as in the lab.
  7. For your program to work, does the Quiz class need to be serializable? Explain in your report.
  8. Now clone your repo into /tmp, then build and run the program from the command line (not Eclipse).
  9. Really do that. Last time, some people didn't and got a slap on the wrist. This time, you won't get credit if your app doesn't build with your build.xml.
  10. Add a screen capture of the successful command-line build and execution in /tmp.
  11. Commit your report and screen capture into your original repo (not the clone) and push.