Lab 9 - Jumble App
Before you Start
- If needed, review these videos.
- Check if your mark for Lab 5 and has been recorded here (log in with your Passport York credentials). You should see something like the following screenshot. If you cannot find your mark, please show Lab 5 and 7 to the teaching assistant again.
Each entry consists of a web page and a zip file.
- Click on the assignment at the course website in Moodle. Submission is only open during the week of the lab and the week that follows.
- Zip the
src folder of your Android project and store the zip file on the desktop (the video entitled AndProject shows you how). Name the file
X is the name of the lab) and drag it to the lab submission site.
- Create your web page (inside Moodle) so it includes the following sections:
- Title and Authors:
This is a two-line header, the first identifies the lab (lab number and name) and the second identifies the team members. For each member, write the Passport York username and the full name.
- Introduction: This is a paragraph in which you describe what you did in this lab. The paragraph is limitted to at most three sentences so you need to abstract the essence of what you did rather than the detailed steps taken.
- Results: This starts with a paragraph that describes your findings: did your work achieve what was required, where there any unexpected results, did certain things not work, etc. This paragraph must be followed by screenshots and/or links to YouTube videos that showcase your findings in action.
- Discussion: In this section you should answer any question asked in the lab document. You can also add here any comment you may have (e.g. what you learned from the lab, what was particularly challenging, etc.).
- Your entry is saved as "draft" and remains as such (so you can optionally edit it) until you submit. Once you are happy with your draft, please ask the teaching assistant to mark your work. If the teaching assistant is happy with your code and web page, click the submit button. Also provide the Passport York username of both members of the group to the teaching assistant.
- You will need a laptop with the EECS VBox (build-2016) installed
(additional information can be found here). This is the same as the one used in EECS 1012. You can use your own laptop or borrow a Departmental one.
- You will also need an Android tablet to deploy your app. A tablet will be given to each pair of students at the beginning of the lab session. You can also deploy your app on your own Android device but the teaching assistant will only mark it on the Departmental tablets.
- Make sure you are familiar with the VBox environment. In particular, you should be able to transfer files from it to the outside; i.e. to the host through a shared folder; to a cloud service (such as Google Drive or DropBox) through a browser; and to a USB drive.
- Make sure you are familiar with capturing screenshots and videos so you can embed them in your ePortfolio entry.
- If you are not 100% comfortable with any of the above then review the Lab Tools document of EECS1012.
Acccording to Wikipedia, "Jumble is a word puzzle with a clue, a drawing illustrating the clue, and a set of words, each of which is jumbled by scrambling its letters. A solver reconstructs the words, and then arranges letters at marked positions in the words to spell the answer phrase to the clue. The clue and illustration always provide hints about the answer phrase."
Your app takes as input a jumbled word and unscrambles it. That is, it provides all words (from a given dictionary) that are an unscrambling of the given input. The view and the controller have already been implemented. Even a part of the model has already been given.
First, create your Jumble App with
The file dictionary.txt can be found here. First save the file on the desktop of your laptop. Transfer the file to the tablet using the File Manager on the tablet. Select PC file transfer (lower left corner). Open a web browser and enter the URL given on your tablet. In the web browser, within the ASUS File Manager, select Internal storage. In this folder you will find folders named Alarms, Android, etc. Do not go in any of these subfolders, but upload the dictionary.txt file in this folder.
Alternatively, you can download the file onto the tablet by visiting the course website and saving it from there. In that way, it ends up in the Downloads folder. This is a sub folder of Internal storage. Move the file from Downloads to Internal storage.
There is a third way to use the file dictionary.txt. In Android Studio, within your project, inside the res folder, create a new Android resource directory named raw, and set its Resource type to raw. Inside that new folder, create a new file named dictionary.txt. Copy the content of dictionary.txt to this new file. Instead of the above model and controller, use
Before running your app, you need configure the device. Go to settings. Selects Apps. Find the Jumble App. Select Permissions. Enable Storage.
It remains to
- add one or more attributes to the model,
- initialize the attributes of the constructor of the model, and
- implement the Unscramble method (remove the return statement - it is added so that the code compiles).
The above can be accomplished in many different ways. Below, some hints are provided that may lead to one way to solve this problem. Note though that you are free to implement your model in other ways as well.
Each word has a "foot print." This foot print tells us for each character how many times that character occurs in the word. For example, the foot print of the word fewest is
(e, 2), (f, 1), (s, 1), (t, 1)
Note that the string seweft also has that foot print. More generally, one word is a jumble of another one if and only if they have the same foot print.
Questions you may consider to solve this lab:
- How do you represent a foot print, that is, which collection do you use?
- How do you compute the foot print of a word?
- How do you store all the words of the dictionary and their foot prints in a collection?
Note that the number of lines of code that need to be added to the Dictionary class need not be more than 20.