Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago