diff --git a/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4DeMorgan.java b/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4DeMorgan.java new file mode 100644 index 0000000..d826652 --- /dev/null +++ b/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4DeMorgan.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.calebfontenot.lab9_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ASDV2 + */ +public class MinimumOf4DeMorgan { + + public static void main(String[] args) + { + Scanner scan = new Scanner(System.in); + + System.out.println("Please neter 3 numbers to find the minimum of the 3:"); + int x = scan.nextInt(); + int y = scan.nextInt(); + int z = scan.nextInt(); + + if (! (x > y)) { + if (!(x > z)) { + System.out.println("minimum= " + x); + } else { + System.out.println("minimum= " + z); + } + } else if (!(y > z)) { + System.out.println("minimum= " + y); + } else { + System.out.println("minimum= " + z); + } + + } + +} diff --git a/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4NestedIfs.java b/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4NestedIfs.java new file mode 100644 index 0000000..445405c --- /dev/null +++ b/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4NestedIfs.java @@ -0,0 +1,52 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.calebfontenot.lab9_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ASDV2 + */ +public class MinimumOf4NestedIfs { + + public static void main(String[] args) + { + Scanner scan = new Scanner(System.in); + + System.out.println("Please neter 3 numbers to find the minimum of the 3:"); + int _1 = 1; //scan.nextInt(); + int _2 = 2; //scan.nextInt(); + int _3 = 3; //scan.nextInt(); + int _4 = 4; //scan.nextInt(); + + if (_1 < _2) { // Is x less than y? + if (_1 < _3) { // Is x less than z? + System.out.println("x is less than z!"); + System.out.println("minimum= " + _1); + } else { + System.out.println("z is less than x!"); + System.out.println("minimum= " + _3); + } + } else if (_2 < _3) { // Is y less than z? + System.out.println("y is less than z!"); + System.out.println("minimum= " + _2); + } else { + System.out.println("z is less than y!"); + System.out.println("minimum= " + _3); + } + /* + if (_1 < _4) { + + //if ( ) { + } else { + System.out.println("w is less than y!"); + System.out.println("minimum= " + _4); + } + */ + } + +}