Question: write java use if/else An online shop is providing offers: 15%, 25% and 35% discount. 15% discount: If your total purchase is more or equal

write java

use if/else

An online shop is providing offers: 15%, 25% and 35% discount.

  • 15% discount: If your total purchase is more or equal than 400 Riyal.
  • 25% discount: If your total purchase is more than 600 Riyal.
  • 30% discount: if your total purchase is more than or equal to 700 Riyal.

Write a java program that asks the user to enter the total amount purchased, then depending on the amount, the program will display You get 100 Riyal discount, 200 Riyal discount, 300 Riyal discount or No discount applied. After that, you will diplay the amount to be paid (with or without discount).

Formula: AmountAfterDiscount=

AmountBeforeDiscount-(AmountBeforeDiscount * Discount/100).

Example: If the discount is 15% and the amount was 450 I will pay:

450-(450*15/100)=382.5Riyal. (Pay attention for the parenthesis).

Use if/else statement

Output example 1:

What is your total amount purchased?

1000

You get 30% discount and you will pay 700 instead of 1000.

Output example 2:

What is your total amount purchased?

150

No discount applied. You will pay 150.

Question 2:

use switch

Write a java program that ask the user to enter * for multiplication or / for division. Then ask the user to enter two numbers.

- If the user enters * , the program should display the multiplication of the two numbers.

- If the user enters /, the program should display the division of the two numbers.

Use Switch STATEMENT

Your output will be as following:

Output:

Which operation you want to perform?

*

Enter the first number

3

Enter the second number

5

The division of 3*5=15

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!