Lab 1 - The BMI Calculator
Before you Start
View these videos. In the videos, this model, this view, this controller, and this test.
ePortfolio Entries
Each entry consists of a web page and a zip file.
- Click Links in the sidebar of the course website in Moodle and then click the link that corresponds to the submission of the lab of this week. 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 Xsrc.zip
(where 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. After you click the submit button, you can no longer edit anything, and then, and only
then, can you ask the teaching assistant to mark your work (i.e. the teaching assistant will not
mark un-submitted draft work).
Programming Environment
- You will need a laptop with the EECS VBox (build-2016) installed
(Link). 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.
Requirement
Build a mobile app that meets the following:
- The app must be Andoid-native; must target IceCream as minimum API level; and must adhere to the MVC architectural design principle.
- The UI must consist of two appropriately-labeled, vertically aligned text boxes, one for entering the weight and the one below it for entering the height. An appropriately-captioned button must appear
under the two boxes. When the button is clicked, the BMI must appear under it.
- Assume (as a precondition) that the weight will be entered correctly as a real number in kg.
- Assume (as a precondition) that the height will be entered correctly as a real number in m.
- No input validation in this release.
- The computed BMI output should be shown rounded to one decimal.
- The output must appear in large text, in blue, in italic style.
- No other output formatting in this release.
Design
The app must have three components: A model named BMIModel
, a view encoded as an XML file, and an activity named BMIActivity
. The three must meet the following:
- The model must be a POJO (i.e. Android-agnostic).
- The BMI (body mass index) is calculated in the model using: weight (in kg) divided by the square of the height (in m).
- The activity instantiates the model when the button is pushed.
- Any validation, computation, and formatting is done in the model.
Implementation
This is your first task.
Testing
This is your second task.
Deployment
This is your third task.
Tasks
Complete the following tasks:
- Implement the BMI project.
- Test your model using a main method and your calculator as oracle.
- Deploy your project on the Departmental tablet.
- Add the following new method to your model:
public String getWeightInPound()
- Implement the new method so that it would return the weight stored in the model's state in pounds rounded to the nearest pound (note that the return is a String, not a double).
- Have your activity invoke the new method and combine its return with the original one so that the full output becomes like this:
"Your weight in pound is xxx and your BMI is xx.x".
- Zip only the
src
folder of your project and name the zip file BMIsrc.zip
. You will submit this file together with your ePortfolio entry.
- Backup your work! Whether you are working on your own laptop or on a loaner, it is a good habbit to always zip the entire project and save the zip file to your cloud and/or USB flash drive.
Deliverables
- The app deployed on a Departmental tablet.
- An ePortfolio entry for this lab submitted with
BMIsrc.zip
attached.
Once you have these deliverables ready, ask your TA to mark your lab.