Due: Monday 3 February 2024, NLT 2359 

Overview

This programming assignment will enhance and test your ability to design non-trivial user interfaces with both Linear and Constraint Layouts.  You will also be required to add some basic functionality.  The end result will be a complete (although useless) app.  Be sure to read and adhere to the course coding standards, found in the Admin section of this site, and properly comment and format your code.

Note: Read the entire assignment before starting to work on it!  

Finally, a reminder:

Collaboration on all programming assignments, projects, and exams in this class is strictly prohibited.

 

Assignment Details

Now that you've successfully recreated the user interface for an Android calculator in class, let's appease all the iPhone fans. We'll build a calculator that looks like the default calculator on iPhone 11.

Your Tasks: 

  1. Create a new Android Studio Project. It must be named A1_YourLastNameYourFirstName
  2. Create the user interface for the iPhone calculator for both portrait and landscape modes (shown above).  You have to use the Text editor for your layouts (XML) NOT design editor.
  3. In your MainActivity, write the proper program logic such that:
  4. Pressing the AC or = buttons should clear the display area.  
  5. The proper layout should be displayed in the respective orientation when the device is rotated.
  6. For the following special, super and subscript characters, append a "#" to the value in the display when pressed, instead of using the value of the button:
  7. There is no requirement to actually do any calculations! (you're welcome)  

Remember, the point of the assignment is to reinforce the topics we've already covered in class.  If you get stuck, go back and review the previous lessons...you'll see that you've already done this before!  

There are many correct ways to do this.  Use whichever method you find most intuitive for you at first, but I challenge you to venture into the land of discomfort...you may actually learn something! 

Hints:

  1. In order to be able to change the background for buttons in your layouts in XML, you will have to change the theme of your app (due to a bug in the Google library used by Android Studio).
  2. Buttons in Android are by default rectangular, but you can create round(ed) buttons using the following method:

Final Thoughts

 

This assignment requires a lot of experimentation.  It's also very time-consuming, so be sure to plan accordingly.  If you wait until the last minute, you will most likely run out of time and be forced to submit substandard work (and nobody likes that!).  Many times when developing Layouts, the changes you've made will seem to have no effect.  Often, this is because you've applied the attribute to the wrong item, or have conflicting attribute values in an item.  Be patient!  There's a reason why we're doing this first.  Mastering Layouts requires due diligence, so take breaks as needed...and a frosty beverage between coding sessions never hurts :-)

Grading

10 pts: Follows directions (4p zip file, 4p screenshots, 2p filenames) 

30 pts: Compiles and loads properly in the first try

15 pts: Proper button functionality

10 pts: Rotates properly and has correct layouts according to orientation

10 pts: Accurate visual portrayal of the iPhone calculator (close to coloring, layout, etc.)

10 pts: Strict following of specs (linear/constraint layout)

10 pts: Code efficiency (good object oriented design)

5 pts: Proper commenting/following of the coding standards

Submission

Submit the following in a single .zip archive file named A1_YourLastNameYourFirstName.zip (e.g. A1_JonesJohn.zip) using the submit system (as submit.cs.usna.edu) under assignment1:

Name the file A1_YourLastNameYourFirstName.zip (e.g. A1_JonesJohn.zip).  Before submitting, double-check to make sure you've followed the course coding standards and your code is well documented.

 ~/bin/submit -c IT=472 -p=assignment1 A1*.zip