Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using if and else statements compute the java program Sample run #1A: Enter the weight for Bananas: 10 Enter the weight for Apples: 11 Enter

Using if and else statements compute the java program

image text in transcribed

Sample run #1A:

Enter the weight for Bananas: 10

Enter the weight for Apples: 11

Enter the weight for Cucumbers: 9

Enter the weight for Carrots: 10.5

Enter the weight for Oranges: 10

Your total is $43.25

Do you have loyalty card (y)? n

Have a nice day!

Sample run #1B:

Enter the weight for Bananas: 10

Enter the weight for Apples: 11

Enter the weight for Cucumbers: 9

Enter the weight for Carrots: 10.5

Enter the weight for Oranges: 10

Your total is $43.25

Do you have loyalty card (y)? y

You got 10% discount $4.32

Your discounted total is $38.92

Have a nice day!

Sample run #2A:

Enter the weight for Bananas: 30.5

Enter the weight for Apples: 21

Enter the weight for Cucumbers: 29

Enter the weight for Carrots: 30.9

Enter the weight for Oranges: 19

Your total is $111.23

Do you have loyalty card (y)? n

You got 10% discount $11.12

Your discounted total is $100.11

Have a nice day!

Sample run #2B:

Enter the weight for Bananas: 30.5

Enter the weight for Apples: 21

Enter the weight for Cucumbers: 29

Enter the weight for Carrots: 30.9

Enter the weight for Oranges: 19

Your total is $111.23

Do you have loyalty card (y)? y

You got 20% discount $22.25

Your discounted total is $88.98

Have a nice day!

Sample run #3A:

Enter the weight for Bananas: 60.5

Enter the weight for Apples: 51

Enter the weight for Cucumbers: 89

Enter the weight for Carrots: 30.9

Enter the weight for Oranges: 19

Your total is $225.53

Do you have loyalty card (y)? n

You got 15% discount $33.83

Your discounted total is $191.70

Have a nice day!

Sample run #3B:

Enter the weight for Bananas: 60.5

Enter the weight for Apples: 51

Enter the weight for Cucumbers: 89

Enter the weight for Carrots: 30.9

Enter the weight for Oranges: 19

Your total is $225.53

Do you have loyalty card (y)? y

You got 25% discount $56.38

Your discounted total is $169.15

Have a nice day!

Write a Java program to perform the grocery check-out procedure for a simple store with exactly 5 products Product Price per pound 0.44 0.99 Bananas Apples Cucumbers $ 1.19 Carrots Oranges 0.89 $0.79 Prompt and get the weight for each product, then compute the total bill. Now, determine th possible discounts for the purchase. Customers can get 2 types of discounts: 10% discount for customers with loyalty cards 10% discount for customers who purchased for $100 or more. This discount increases to 15% if the customer purchased for $200 or more. Both types of discounts can be combined. Our program should give maximum possible discount to each customer. Save your program as Store.java and upload it to complete the assignment. You can assume that all the user inputs are valid & the user will enter O for products (s)he does not purchase no need to do any input validation explicitly. Here are a few sample inputs & outputs (but your program should work for all valid inputs. TA will test with other values)

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_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago