COM413 Mobile Application Development Practical Workbook 2 Guidance

Published: 06 Feb, 2025
Category Assignment Subject Programming
University Ulster University Module Title COM413: Mobile Application Development

Question 1. Sum of Even Numbers

Create a program to calculate and print the sum of all even numbers between 1 and a given positive integer. For example, ask the user to input a positive number, we’ll say 10. We can then add the even numbers in two ways, start at 2 and add 2 each time until the positive number is reached or modulus each number in the range by 2 (%2) if the result is 0, the number is even. Create two
methods, and test the code in order to determine the fastest method.

So, from 1 to 10, the even numbers are: 2, 4, 6, 8 and 10 and the sum of all these numbers is 30. You should use System.nanoTime().

Question 2. Prime Number Check

Create a program to determine if a given number is prime or not. A prime number is only divisible by 1 and itself.

To check if a number is prime, you only need to test divisibility with integers up to its square root. If no divisors are found within this range, the number is prime. This approach optimizes the prime number checking process by reducing unnecessary calculations and iterations.

If a number is not prime, it can be represented as the product of two factors, a and b, where 1 < a <=

b. One of these factors, a or b, will be less than or equal to the square root of the number we are checking. If both factors were greater than the square root of this number, their product would begreater than num.

E.g. 811 is a prime number, the Square root of 811 is 28.48, therefore, we don’t need to check if 811 is divisible by numbers greater than 28 as 29x29 = 841 which is too big

Question 3. Finding Maximum and Minimum

Create a program to find the maximum and minimum values in an array of integers. Ask the user how many numbers they want to add to an array, if they say 5. Ask them for each number. When the array is complete, the program will then search through the array for the smallest number and then the largest number. Use two separate methods to calculate these.

Question 4. Temperature Converter: - 10 marks

Student Name. B-number.

Create a program to convert temperatures between Celsius and Fahrenheit. The formula for the conversion is: (0°C × 9/5) + 32 = 32°F

You should ask the user to select from a conversion from degrees Celsius to Fahrenheit or Fahrenheit to degrees Celsius.

Question 5. Palindrome Check

Create a program to check whether a given string is a palindrome (reads the same forwards and backwards). An example of a palindrome is the word Racecar. Ask the user to input a word, and pass the string as a parameter. Don’t forget to use the string.toLowerCase() method.

You can then check the characters match from left to right.

Question 6. Volumes

Create a program which can calculate the volume of a sphere or cylinder using the formulas below:

You should ask the user to input either sphere or cylinder in some way and then use a method to calculate and return the result. Print the result to 2 d.p.

Use the math function Math.pow(double n, double p) to calculate a number n to power p. Likewise use the Math.PI constant to obtain the value of Pi.

Question 7. Print Patterns

Create a program which will print various patterns using nested loops. There should be 3 options:

Square, right-handed triangle and pyramid.

Question 8. Roman Numerals

Create a program which will convert a decimal number to Roman numerals. Roman numeral converters can convert numbers from 1 to 3,999 into Roman numerals.

Roman numerals are a number system developed in ancient Rome where letters represent numbers.

The modern use of Roman numerals involves the letters I, V, X, L, C, D, and M.

There are a number of ways to do this, first prompt your user to enter a number between 1 and 3,999. Next you can call a method and pass the number as a parameter. Using a String array to record your new array made up of Roman Numerals, you can take the original number and divide it by thousands, hundreds, tens and ones.

On paper this is done as such:

Let’s use the number 3450 as an example.

If we divide 3000 by 1000 we get 3 = this is 3 Ms so the equivalent is MMM We divide 400 by 100 we get 4 = this is not CCCC but in Roman numerals it would be C(100) D (500) or CD.

We have a remainder of 50 which is equivalent to L so the String would read MMMCDL.

An easy way to do this is to have 4 arrays, one each for thousands, hundreds, tens and ones and use the corresponding array position to create your string: String[] thousands = {"", "M", "MM", "MMM"};

Question 9. Pig Latin

Create a program which will convert a phrase into simple Pig Latin. Pig Latin is a language game or argot in which words in English are altered, usually by adding a fabricated suffix or by moving the onset or initial consonant or consonant cluster of a word to the end of the word and adding a vocalic syllable to create such a suffix. How to Speak Pig Latin

This has 2 principles:

1. If the word starts with a vowel (AEIOU) you add “-ay” to the end of the word. Elephant would become elephant-ay.
2. If it starts with a consonant, you start the word from the first vowel in a string and add the consonant cluster onto the end and again add the suffix ay. So, Hello would become ellohay.

This becomes more complicated with more words. So, start with one word, and check for vowels.

Next, when dealing with a consonant, remove the first letter only and add it to the end with ay.

Note: It is possible to use the indexof function to find the next vowel and create a substring by removing the characters that precede the vowel but this gets too complicated.

Verify your results here: Pig Latin

Question 10. Hex to Decimal

Now we want to build a Hex to decimal converter. Hexadecimal is a numbering system with base 16.

It can be used to represent large numbers with few digits. In this system there are 16 symbols or possible digit values from 0 to 9, followed by six alphabetic characters -- A, B, C, D, E and F see below.
A – 10 D - 13
B – 11 E - 14
C – 12 F - 15

We want to create a program which will read an array of Hex values and convert this to its corresponding decimal value.
How we do this is we use a table as such:

3B in base 16 is equal to each digit multiplied with its corresponding 16n:
3B16 = 3×161
+11×160 = 48+11 = 5910

FF hex to decimal

We use the base 16 and we multiply it by the number in the array, depending on the position of the array we can use 16i or 16[i] to represent the Most Significant Bit (MSB) down to the Least Significant Bit (LSB). What we do is read an array as such:

We can then calculate: FF16 = 15×161 +15×160 = 240 + 15 = 255.

If you are looking for solutions to your assignment of COM413: Mobile Application Development, then our Programming Assignment Help Services is just that. Thus, you can be sure that Ulster University students get perfect university assignment help; there you will get expert guidance, especially on the key areas of mobile app development such as coding, UI/UX design, and app functionality. With our assignment writing services in UK, you also get free samples written by PhD experts, and are absolutely original content. So make your assignment easier, get in touch now!

To get a solution for this course, click here: COM413 Mobile Application Development Example

Workingment Unique Features
MED-7024F: Transferrable Skills Grant Application Project Work UEA MRes 2025

MED-7024F: This assignment is intended to approximate a real-life grant application to one of the major funding bodies. Students will be asked to identify a suitable potential funder and scheme, but will be required

MIS171 Business Analytics Assignment 3 Tri1 2025 | DU

MIS171 Business Analytics Assignment 3: The assignment requires that you analyse a data set, interpret, and draw conclusions from your analysis, and then convey your conclusions in a written report.

MGT 200 Team Management Final Assessment Question 2 | SNHU

Earth-Kind, headquartered in Bismarck, North Dakota, in the USA, was founded in 1993 by Kari Warberg Block (Kari). Kari's entrepreneurial journey started when she began selling potpourri and organic produce on her farm. She then went into manufacturing.

Assessment Final: Critically appraise the design and findings of a research study related to a public health issue

Assessment: Having completed this module, you are now ready to independently read, interpret, and critically appraise published research. In this 2000-word assignment, you will critically review a paper published

IS333 Project Management Assignment 2 Brief Semester 1 2025 | USP

ABC Bank is a mid-sized banking institution operating nationally with over 12 branches and 1 million customers. The bank currently relies on a fragmented system of legacy software tools for its operations.

NVQ Level 3 Health and Safety Risk Management Assignment Brief 2025

It is recommended that you include an example of a risk assessment procedure and what you did with the results to change or adjust work practices or environmental features to reduce risk.

HSY2603 Assignment 4 Portfolio Essay Question - Unisa

HSY2603 ESSAY QUESTIONS: Discuss the significance of the discovery of rich resources of diamonds and gold in southern Africa between the 1860’s and the 1890’s.

T/650/9628 BTEC Level 4 Unit Engineering Design Assignment Brief | UOS

You work as a design engineer for a small manufacturing company and have been asked to meet with a potential customer. The company mass-produces Printed Circuit Boards (PCBs) for laptop computers, in factories across Asia, the Far East and South America.

K/615/1475 BTEC Level 4 Engineering Design Assignment 01 Brief | LSBU

You work for a company that provides design solutions for a range of businesses and clients for both Mechanical and Electrical engineering applications. You have been approached by a client who utilises Automated Seedling Transplanters in the function of their farming operation.

K/618/4167 ATHE Level 3 Unit 1  Structure and Overview of the Health and Social Assignment Brief

K/618/4167 ATHE Level 3 Unit 1 Assignment: You are doing a work placement in the training department of a large health and social care organisation. The manager has asked you to draft some materials for an induction programme

Online Assignment Help in UK