Sample Midterm Solutions

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

Requirements I-IV are located in the comments in my Shop.

java

Sample Outputs

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:1
Please enter the number of items:3
Enter name of product 1:a
Enter price of product 1 per package:10
enter the number of packets x for special discount (buy x get 1 free)1:2
Enter name of product 2:b
Enter price of product 2 per package:30
enter the number of packets x for special discount (buy x get 1 free)2:3
Enter name of product 3:c
Enter price of product 3 per package:30
enter the number of packets x for special discount (buy x get 1 free)3:3
Please enter the amount to qualify for additionaldiscount:100
Please enter the discount rate (0.1 for 10%):.4
This program supports 4 functions:
1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:2

Enter the amount of a:10


Enter the amount of b:20
Enter the amount of c:40

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:3

10 packages of a @ $10.0 per pacckge = $100.0


20 packages of b @ $30.0 per pacckge = $600.0
40 packages of c @ $30.0 per pacckge = $1200.0

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:4

Thanks for coming!


Sub Total : $1900.0
SpecialDiscount : -$480.0
NewsubTotal : $1420.0
AdditionalDiscount : -$568.0
Total :$852.0________________________________________________

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:1
Please enter the number of items:2
Enter name of product 1:alpha
Enter price of product 1 per package:10
enter the number of packets x for special discount (buy x get 1 free)1:2
Enter name of product 2:beta
Enter price of product 2 per package:40
enter the number of packets x for special discount (buy x get 1 free)2:3
Please enter the amount to qualify for additionaldiscount:50
Please enter the discount rate (0.1 for 10%):0.35
This program supports 4 functions:
1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:2

Enter the amount of alpha:20


Enter the amount of beta:60

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:3

20 packages of alpha @ $10.0 per pacckge = $200.0


60 packages of beta @ $40.0 per pacckge = $2400.0

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:4

Thanks for coming!


Sub Total : $2600.0
SpecialDiscount : -$660.0
NewsubTotal : $1940.0
AdditionalDiscount : -$679.0
Total : $1261.0
This program supports 4 functions:
1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:2

Shop is not setup yet!

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:1
Please enter the number of items:3
Enter name of product 1:apple
Enter price of product 1 per package:30
enter the number of packets x for special discount (buy x get 1 free)1:4
Enter name of product 2:orange
Enter price of product 2 per package:40
enter the number of packets x for special discount (buy x get 1 free)2:2
Enter name of product 3:banana
Enter price of product 3 per package:5
enter the number of packets x for special discount (buy x get 1 free)3:4
Please enter the amount to qualify for additionaldiscount:20
Please enter the discount rate (0.1 for 10%):0.234
This program supports 4 functions:
1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:3

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:2

Enter the amount of apple:100


Enter the amount of orange:200
Enter the amount of banana:300

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:3

100 packages of apple @ $30.0 per pacckge = $3000.0


200 packages of orange @ $40.0 per pacckge = $8000.0
300 packages of banana @ $5.0 per pacckge = $1500.0

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:4

Thanks for coming!


Sub Total : $12500.0
SpecialDiscount : -$3540.0
NewsubTotal : $8960.0
AdditionalDiscount : -$2096.6400000000003
Total : $6863.36
This program supports 4 functions:
1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:3

Shop is not setup yet!

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:2

Shop is not setup yet!

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:1
Please enter the number of items:4
Enter name of product 1:shampoo
Enter price of product 1 per package:20
enter the number of packets x for special discount (buy x get 1 free)1:3
Enter name of product 2:conditioner
Enter price of product 2 per package:40
enter the number of packets x for special discount (buy x get 1 free)2:1
Enter name of product 3:facewash
Enter price of product 3 per package:30
enter the number of packets x for special discount (buy x get 1 free)3:2
Enter name of product 4:hairgel
Enter price of product 4 per package:20
enter the number of packets x for special discount (buy x get 1 free)4:0
Please enter the amount to qualify for additionaldiscount:100
Please enter the discount rate (0.1 for 10%):0.6
Invalid valuePlease enter the discount rate (0.1 for 10%):0.12
This program supports 4 functions:
1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:2

Enter the amount of shampoo:10


Enter the amount of conditioner:30
Enter the amount of facewash:50
Enter the amount of hairgel:30

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:3

10 packages of shampoo @ $20.0 per pacckge = $200.0


30 packages of conditioner @ $40.0 per pacckge = $1200.0
50 packages of facewash @ $30.0 per pacckge = $1500.0
30 packages of hairgel @ $20.0 per pacckge = $600.0

This program supports 4 functions:


1. Setup Shop
2. Buy
3. List Items
4. Checkout
Please choose the function you want:4

Thanks for coming!


Sub Total : $3500.0
SpecialDiscount : -$1120.0
NewsubTotal : $2380.0
AdditionalDiscount : -$285.59999999999997
Total : $2094.4

You might also like