QuestionQuestion

Create an Android application that displays on a second screen the amount of sales on a purchase with the tax included.
On the initial screen (first screen) the user submits the purchase amount and selects the state where the purchase is being made from a ListView.
You are given a CSV with all the states' tax rate.
After the user clicks (taps) on a state from the list, the program displays on the second screen the final sales on the purchase with the tax added and confirms the state and the corresponding tax.
Note:
1. Ensure the user only enters numeric values for purchase amount
2. Ensure the user selects a state from the list of radio buttons
3. Store the taxes in a type double array.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

* An activity representing a list of Items. This activity
* has different presentations for handset and tablet-size devices. On
* handsets, the activity presents a list of items, which when touched,
* lead to a {@link ItemDetailActivity} representing
* item details. On tablets, the activity presents the list of items and
* item details side-by-side using two vertical panes.
*/
public class ItemListActivity extends AppCompatActivity {

    /**
    * Whether or not the activity is in two-pane mode, i.e. running on a tablet
    * device.
    */
    private boolean mTwoPane;

    private EditText editText;

    SimpleItemRecyclerViewAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_item_list);

       Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
       setSupportActionBar(toolbar);
       toolbar.setTitle(getTitle());

       editText = (EditText) findViewById(R.id.amount);

       if (findViewById(R.id.item_detail_container) != null) {
            // The detail container view will be present only in the
            // large-screen layouts (res/values-w900dp).
            // If this view is present, then the
            // activity should be in two-pane mode.
            mTwoPane = true;
       }

       readData();
       View recyclerView = findViewById(R.id.item_list);
       assert recyclerView != null;
       setupRecyclerView((RecyclerView) recyclerView);
    }

    private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
       adapter = new SimpleItemRecyclerViewAdapter(this, DummyContent.ITEMS, mTwoPane);
       recyclerView.setAdapter(adapter);
    }

    public class SimpleItemRecyclerViewAdapter
            extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> {

       private final ItemListActivity mParentActivity;
       private final List<DummyContent.DummyItem> mValues;
       private final boolean mTwoPane;
       private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummyContent.DummyItem item = (DummyContent.DummyItem) view.getTag();
                if (mTwoPane) {
                   Bundle arguments = new Bundle();
                   arguments.putString(ItemDetailFragment.ARG_ITEM_ID, item.id);
                   ItemDetailFragment fragment = new ItemDetailFragment();
                   fragment.setArguments(arguments);
                   mParentActivity.getSupportFragmentManager().beginTransaction()
                            .replace(R.id.item_detail_container, fragment)
                            .commit();
                } else {
                   Context context = view.getContext();
                   Intent intent = new Intent(context, ItemDetailActivity.class);
                   intent.putExtra("amount", editText.getText().toString());
                   intent.putExtra(ItemDetailFragment.ARG_ITEM_ID, item.id);

                   context.startActivity(intent);
                }
            }
       };

       SimpleItemRecyclerViewAdapter(ItemListActivity parent,
                                     List<DummyContent.DummyItem> items,
                                     boolean twoPane) {
            mValues = items;
            mParentActivity = parent;
            mTwoPane = twoPane...

By purchasing this solution you'll be able to access the following files:
Solution.docx and Solution.zip.

$25.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available App Development Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats