-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice2c.java
More file actions
61 lines (55 loc) · 1.12 KB
/
Copy pathpractice2c.java
File metadata and controls
61 lines (55 loc) · 1.12 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
/*
* This program prompts the user to input a radius for a sphere and computes and displays the volume of sphere with a given radius by the user.
*
* @author {user}
* Course: COMP B11
* Created: Jan 31, 2017
* Source File: SphereVolumeInputPrintf.java
*/
import java.util.Scanner;
public class practice2c {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int a;
int b;
int c;
int d = 44;
boolean b1;
boolean b2;
System.out.print("Enter integers for a, b, c.\n");
a = in.nextInt();
b = in.nextInt();
c = in.nextInt();
System.out.print("Enter true/false for b1 and b2.\n");
b1 = in.nextBoolean();
b2 = in.nextBoolean();
if (a == b || c == a + b)
{
if (b1 && b2)
{
d = a + b;
System.out.printf("Int d = %d\n", d);
}
else
{
d = a - b;
System.out.printf("Int d = %d\n", d);
}
}
else if (b1 || a > b)
{
if (c >= b && b2)
{
d = a * b;
System.out.printf("Int d = %d\n", d);
}
else
{
d = 99;
System.out.printf("Int d = %d\n", d);
}
in.close();
}
}
}