ask1: Arithmetic Operations (Java) An electronics store is giving discount based on the number of items purchased as given in the table below: Number of items Discount Up to 5 0 >5 but <10 5% >10 but <15 10% >15 but <20 15% >20 20% Write a Java application to perform the following: Prompt the user for entering the number of items purchased and the total amount; Calculate the net amount to be paid after discount; Output the summary of the task as follows: Total number of items and bill amount; The discount in %; The net amount to be paid in three significant digits after the decimal point.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Task1: Arithmetic Operations (Java)
An electronics store is giving discount based on the number of items purchased as given in the table below:
Number of items |
Discount |
Up to 5 |
0 |
>5 but <10 |
5% |
>10 but <15 |
10% |
>15 but <20 |
15% |
>20 |
20% |
Write a Java application to perform the following:
- Prompt the user for entering the number of items purchased and the total amount;
- Calculate the net amount to be paid after discount;
- Output the summary of the task as follows:
- Total number of items and bill amount;
- The discount in %;
- The net amount to be paid in three significant digits after the decimal point.
Step by step
Solved in 3 steps with 2 images