Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3600625 • Letter: C

Question

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

In this exercise you’ll 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 that’s in the directory.

murachndroidex_starts

    

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

Handle the editor Action Event

3.Open the Invoice Total Activity class that’s 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 doesn’t display a starting value for the subtotal.

10.Test the app again. This time, it shouldn’t 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.

Explanation / Answer

a sample code of java

java.util.Scanner;

class Discount
{
   public static void main(String args[])
   {

   double dis,amount,markedprice,s;
  
   Scanner sc=new Scanner(System.in);
  
   System.out.println("enter markedprice ");  
             
   markedprice=sc.nextDouble();

        System.out.println("enter discount percentage ");  
             
   dis=sc.nextDouble();          
  
        s=100-dis;

   amount= (s*markedprice)/100;

   System.out.println("amount after discount="+amount);

   }
}