Question: PROBLEM DESCRIPTION In this app, youll be building a simple app that lets a customer order ice cream. Here is an example: DESCRIPTION OF APP

PROBLEM DESCRIPTION

In this app, youll be building a simple app that lets a customer order ice cream.

Here is an example:

DESCRIPTION OF APP FEATURES

REPRESENTING AN ICE CREAM FLAVOUR (10 marks)

The app displays the current ice cream flavour for sale.

Example of the ice cream flavour

The Ice Cream Flavour is represented in code as a custom Java class. The class has the following properties and methods:

Given a quantity, the getTotalCost() function returns the price of the ice cream as a double.

When you app loads,

  • Create an instance of the Brazillian Lighting ice cream flavour. Details on this flavour are shown in the following table

  • Update the user interface with the flavour name, flavour description, quantity remaining, and price.

flavor

description

quantityAvailable

price

Brazilian Lightning

Dairy-free vanilla ice cream mixed with acai, bananas, and a drizzle of strawberry syrup.

8

3.15

Description of the Brazillian Lighting ice cream flavour.

PLACING AN ORDER - VALIDATION (5 marks)

The user can place an order by pressing on the PLACE ORDER button.

There are two conditions that must be met before the sale can be made:

  1. The user must enter a positive number in the quantity textbox. If the user enters 0 or a negative value into the textbox, display an error message

  2. There must be enough ice cream to sell the customer. For example, if there are only 2 scoops of ice cream available; and the customer orders 5 scoops, display an error message.

Error messages should be shown in a Toast

Example of a Toast in Android

DISPLAYING AN ORDER SUMMARY (5 marks)

At the bottom of the app, there is a section for displaying the results of the order:

By default, this section should be hidden from the user.

If an order can be successfully placed:

  1. the app should show the section. Example: https://stackoverflow.com/a/17076583

  2. The section should be updated to display

  • the name of the selected flavour,

  • The number of scoops order

  • The price per scoop

  • The total cost of the ice cream (number of scoops x price per scoop). You must use the flavour objects getTotalCost() function to calculate and display the cost.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!