Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please help me on this Mobile Application (Android Studio) in JAVA. Thanks for helping me In this exercise youll add functionality to an

Could you please help me on this Mobile Application (Android Studio) in JAVA. Thanks for helping me

In this exercise youll add functionality to an invoice Total app. When you are done, a test run should look something like this

Invoice Total

Subtotal 150

Discount Percent 10%

Discount Amount $75.00

Total $135.00

Open the app and test it

1. Start Android Studio and open the project named ch03_ex1_Invoice thats in the directory.

\murach\android\ex_starts

2. Run this project and test the app with a valid subtotal like 100. The app should accept this input, but it shouldnt perform any calculations or display any results.

Handle the editor Action Event

3.Open the Invoice Total Activity class thats in the java directory of the project.

4.Use the on create method to get references to the EditText widget and the three TextView widgets that display data.

5.Creat a method named calculateAndDisplay. This method should get the subtotal value. Then, it should calculate the discount amount and total. It should give a 20% discount if the subtotal is greater than or equal to 200, a 10% discount if the subtotal is greater than or equal to 100, and no discount if the subtotal is less than 100.

6.Add code to the end of the calculateAndDisplay method that dispalys the results of the calculation on the widgets for the discount percent, discount amount and total.

7.Handle the Editor action event for the EditText widget so that it executes the calculateAndDisplay method when the done key is pressed.

8.Test the app. It should display the starting values that are coded in the strings.xml file.

Set the starting values correctly

9.Modify the strings.xml file so it doesnt display a starting value for the subtotal.

10.Test the app again. This time, it shouldnt display a starting value for the subtotal. Enter some values for the subtotal and make sure it works correctly.

Handle orientation changes

11.Override the onResume method and use it to call the calculateAndDisplay method.

12.Test the app again. Make sure to change the orientation of the activity. The activity should retain all of its date.

Handle navigation

13.Press the back key to navigate away from the app. Then navigate back to the app. In an emulator, you can do this by clicking on the apps icon and clicking on the invoice Total app. The activity should lose all of its data.

14.Override onPause method so it saves the string for the subtotal. Then, modify the onTesume method so it gets the string for the subtotal. To get these method to work correctly, you need to set up instance variables for the subtotal string and for a SharedPreferences object that you can use to save and get this string.

15.Test the app again. This time, the app should always remember the last subtotal that you entered even if you navigate away from the app and return to it. In addition, the app should always calculate and display the correct values for the discount percent, discount amount, and total.

Set a launcher icon(optional)

16.Set a launcher icon for the app. You should be able to download possible icons by searching the internet. When you do that, make sure you have permission to use the image or that it is available under a license that allows you to use it legally.

17.Test the app again. Note that launcher icon is available from your device or emulator. Just like the launcher icon for any other app.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions