forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdsWholesaleStringCheese.java
More file actions
67 lines (57 loc) · 2.29 KB
/
EdsWholesaleStringCheese.java
File metadata and controls
67 lines (57 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.util.Scanner;
public class EdsWholesaleStringCheese
{
public static void main(String[] args)
{
int handlingCharge = 5;
System.out.println("Welcome to Crazy Ed's Wholesale String Cheese!");
System.out.println("What can we get for you today?");
System.out.println("Select from 1 inch, 2 inch or 3 inch");
int order;
Scanner in = new Scanner(System.in);
order = in.nextInt();
System.out.println("How many yards would you like?");
int yards;
yards = in.nextInt();
int oneInch = (2 * yards) + (2 * yards) + handlingCharge;
int twoInch = (4 * yards) + (2 * yards) + handlingCharge;
int threeInch = (6 * yards) + (4 * yards) + handlingCharge;
int freeShip1 = 2 * yards;
int freeShip2 = 2 * yards;
int freeShip3 = 4 * yards;
if (order == 1 && yards <= 50)
{
System.out.println("$2/yd plus $2/yd shipping");
System.out.println("Your total with shipping and handling fees is $" + oneInch);
}
else if (order == 1 && yards > 50)
{
System.out.println("$2/yd with FREE shipping!");
System.out.println("Your total delivery charge with FREE shipping is $" + (oneInch - freeShip1));
}
else if (order == 2 && yards <= 75)
{
System.out.println("$4/yard plus $2/yd shipping");
System.out.println("Your total with shipping and handling fees is $" + twoInch);
}
else if (order == 2 && yards > 75)
{
System.out.println("$4/yd with FREE shipping!");
System.out.println("Your total delivery charge with FREE shipping is $" + (twoInch - freeShip2));
}
else if (order == 3 && yards <=25)
{
System.out.println("$6/yd plus $4/yd shipping");
System.out.println("Your total with shipping and handling fees is $" + threeInch);
}
else if (order == 3 && yards > 25)
{
System.out.println("$6/yd with FREE shipping");
System.out.println("Your total delivery charge with FREE shipping is $" + (threeInch - freeShip3));
}
else
{
System.out.println("Your order is too crazy!!!");
}
}
}