lab9 misery
This commit is contained in:
parent
121f8ed3e1
commit
5f825c63f7
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user