-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClasses.java
More file actions
46 lines (33 loc) · 1.38 KB
/
Classes.java
File metadata and controls
46 lines (33 loc) · 1.38 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
/************************************************************/
/*Program: Classes */
/*CIS163AA 31892 */
/*Marc Holley */
/*4/10/2016 */
/*this program demonstrates classes */
/************************************************************/
import java.util.Scanner;
// Class
public class Classes {
// main method
public static void main(String[] args) {
// constructing new Classes class
Classes2 class1 = new Classes2();
// declaring and initalizing variable(s)
int numInput;
// constructing new scanner class
Scanner scnr = new Scanner(System.in);
// prompting user for input
System.out.println("Enter a even or odd number: ");
numInput = scnr.nextInt();
// conditional statement with logical operands
if (numInput % 2 == 0) {
System.out.println("Your number is even.");
}
// conditional statement with logical operands
else {
System.out.println("Your number is odd.");
}
// method class call with passby reference
class1.positiveOrNegative(numInput);
}
}