联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2025-02-15 02:10

COMP S311

Advanced Java Programming and

Mobile Application Development

Autumn 2024 Presentation

Assignment 03

Please submit this assignment to OLE by 10 February 2025

COMP S311 Assignment 03 (Autumn 2024)

2

Preamble

This assignment covers COMPS 311 Units 6 to 7. You will attempt problems related to

resources, layout, fragments, networking and concurrency. Hope you will enjoy this

assignment.

Kevin Tse

COMP S311 CC

COMP S311 Assignment 03 (Autumn 2024)

3

Question 1 – Basics and resources [20 marks]

In this question, you create an Android app that displays some text according to the device

orientation.

- The name of the app is “COMPS311A3”, and the package name of the app (i.e. app id)

is “comps311.a3.q1”.

- By default, the app displays your name in English, your student ID, and the current

time in three lines.

The following are sample outputs when the app is.

Submit one whole Android project that contains all your work for this question.

COMP S311 Assignment 03 (Autumn 2024)

4

Question 2 – Layout and UI [40 marks]

In this question, you develop a simple calculator app. A skeleton project, called Calculator,

is provided to you. Complete the app according to the following screenshots and

requirements.

COMP S311 Assignment 03 (Autumn 2024)

5

a. Modify the default/portrait activity_main.xml layout (included in the skeleton

project) to add the 17 buttons (0, 1, …, 9, . the dot, =, +, -, *, /, C) under the output

display.

b. Create a new activity_main.xml landscape layout that contains the same

components in the default layout (with the same IDs).

c. In the MainActivity class, modify the onCreate method as follows:

o Fill in the buttonIDs integer array with the IDs of the 17 buttons.

o In the for-loop, find the button from the ID and set up the button’s click listener. The click-listener puts the text (label) of the button to the

CalculatorData (using the enter method), obtains the output of the

CalculatorData (using the getOutput method), and displays the output

to the UI.

d. Create an XML menu file; in the file, create an “About” options menu item and show

it as an action item. You may use a built-in Android drawable resource as its icon.

When the item is selected, an “About” dialog box appears to show your name and

your student ID.

e. Create three options menu items “Large text size”, “Medium text size”, and

“Small text size”. These menu items are checkable, mutually exclusive, and in a

group. They control the text size of the output display. To set the text size in code,

you may use the constants SMALL_TEXT_SIZE, MEDIUM_TEXT_SIZE, and

LARGE_TEXT_SIZE in the MainActivity class.

Submit one whole Android project that contains all your work for this question.

COMP S311 Assignment 03 (Autumn 2024)

6

Question 3 – Fragments, networking and

concurrency [40 marks]

In this question, you develop an Android that views protocol and host of an URL. A skeleton

project, called UrlInfo, is provided to you. Complete the project by working through the

following tasks.

a. In the MainActivity class, create and show the MainFragment when the app

starts. The main screen is similar to the left screenshot shown below.

b. In the MainFragment class, set up the “Get URL Info” button to determine the

protocol and host of the input URL. Display the result in the result field; in case of

error, display the error message instead. Note that multithreading should be applied in

network communication in order to maintain responsiveness of user interface. Also,

you should execute all the UI operations in the UI thread.

c. In the MainFragment class, append a history message to the MainActivity’s

history object (StringBuilder) after the protocol and host have been retrieved

by clicking on the "Get URL Info" button. For a history message, it contains the

protocol, host, and the surfing date/time; in case of error, no history message should

be logged. Refer to the right screenshot below for some example history messages.

d. In the MainFragment class, set up the “View History” button to show the history

messages.

e. Create a HistoryFragment class and its associated fragment_history.xml

layout, for displaying the MainActivity’s history result. Refer to the right

screenshot below.

The following screenshots show the main screen (left) and history screen (right) of the app.

Submit one whole Android project that contains all your work for this question.

COMP S311 Assignment 03 (Autumn 2024)

7

End of Assignment

COMP S311 Assignment 03 (Autumn 2024)

8

Appendix A Assignment Submission Format

• Submit a report containing answer to the required questions. Your report should be

stored in a Word format.

• You should then ZIP up the report document with other required files (such as Java

program files). Name the ZIP file in the format of Assignment03-

SXXXXXXXX.zip, where XXXXXXXX is your student ID.

• Submit the ZIP file to the OLE Assignment Submission system.

• If you have a difficulty with submission, please discuss with your tutor or the course

coordinator.

Appendix B Extension Application

• Please submit the assignments on or before the cut-off dates.

• Your tutor is authorized to grant extension of up to seven days.

• Only in the circumstances of sickness (with medical proof), long business trips (at

least a week long and happen within 2 weeks of the cut-off dates), and exceptional

events would extension of 8 to 21 days be considered. Please apply through the

OLE Assignment Records and Extension System. You may be required to send in

supporting documents.

• No marks will be awarded for any late assignments without prior approval obtained

from the Course Coordinator and/or the Dean.

• If you are in an exceptionally difficult situation and unable to submit within 21 days,


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp