Reset author name to chosen name ✨
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.chloefontenot.lab9_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Lab9_ChloeFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.lab9_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
public class MinimumOf3 {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
System.out.println("Please enter 4 numbers to find the minimum of the 4: ");
|
||||
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);
|
||||
|
||||
*/
|
||||
System.out.println(
|
||||
(x < y)
|
||||
? (x < z) ? "minimum= " + x
|
||||
: "minimum= " + z
|
||||
: (y < z) ? "minimum= " + y : "minimum= " + z
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.lab9_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
public class MinimumOf4ConditionalOperator {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner scan = new Scanner(System.in);
|
||||
while (true) {
|
||||
System.out.println("Please enter 4 numbers to find the minimum of the 4: ");
|
||||
int _1 = scan.nextInt();
|
||||
int _2 = scan.nextInt();
|
||||
int _3 = scan.nextInt();
|
||||
int _4 = scan.nextInt();
|
||||
|
||||
System.out.println("minimum= "
|
||||
+ ((_1 < _4)
|
||||
? (_1 < _3)
|
||||
? (_1 < _2)
|
||||
? _1
|
||||
: _2
|
||||
: (_3 < _2)
|
||||
? _3
|
||||
: _2
|
||||
: (_4 < _3)
|
||||
? (_4 < _2)
|
||||
? _4
|
||||
: _2
|
||||
: (_3 < _2)
|
||||
? _3
|
||||
: _2)
|
||||
);
|
||||
scan.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.lab9_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
public class MinimumOf4DeMorgan {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner scan = new Scanner(System.in);
|
||||
while (true) {
|
||||
System.out.print("Please enter 4 numbers to find the minimum of the 4: ");
|
||||
System.out.println("");
|
||||
int _1 = scan.nextInt();
|
||||
int _2 = scan.nextInt();
|
||||
int _3 = scan.nextInt();
|
||||
int _4 = scan.nextInt();
|
||||
|
||||
if (!(_1 > _4 || _1 > _3 || _1 > _2)) { // Is 1 the minimum?
|
||||
System.out.println("minimum= " + _1);
|
||||
} else if (!(_2 > _4 || _2 > _3 || _2 > _1)) { // Is 2 the minimum?
|
||||
System.out.println("minimum= " + _2);
|
||||
} else if (!(_3 > _4 || _3 > _2 || _3 > _1)) { // Is 3 the minimum?
|
||||
System.out.println("minimum= " + _3);
|
||||
} else { // All other conditions failed, _4 must be the minimum
|
||||
System.out.println("minimum= " + _4);
|
||||
}
|
||||
scan.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.lab9_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
public class MinimumOf4NestedIfs {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
while (true) {
|
||||
System.out.println("Please enter 4 numbers to find the minimum of the 4: ");
|
||||
int _1 = scan.nextInt();
|
||||
int _2 = scan.nextInt();
|
||||
int _3 = scan.nextInt();
|
||||
int _4 = scan.nextInt();
|
||||
|
||||
if (_1 < _4) {
|
||||
if (_1 < _3) {
|
||||
if (_1 < _2) {
|
||||
System.out.println("minimum= " + _1);
|
||||
} else {
|
||||
System.out.println("minimum= " + _2);
|
||||
}
|
||||
} else {
|
||||
if (_3 < _2) {
|
||||
System.out.println("minimum= " + _3);
|
||||
} else {
|
||||
System.out.println("minimum= " + _2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (_4 < _3) {
|
||||
if (_4 < _2) {
|
||||
System.out.println("minimum= " + _4);
|
||||
} else {
|
||||
System.out.println("minimum= " + _2);
|
||||
}
|
||||
} else {
|
||||
if (_3 < _2) {
|
||||
System.out.println("minumum= " + _3);
|
||||
} else {
|
||||
System.out.println("minimum= " + _2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scan.next();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.lab9_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ASDV2
|
||||
*/
|
||||
public class MinimumOf4WithANDs {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner scan = new Scanner(System.in);
|
||||
while (true) {
|
||||
System.out.print("Please enter 4 numbers to find the minimum of the 4: ");
|
||||
int _1 = scan.nextInt();
|
||||
int _2 = scan.nextInt();
|
||||
int _3 = scan.nextInt();
|
||||
int _4 = scan.nextInt();
|
||||
System.out.println("");
|
||||
|
||||
if (_1 <= _4 && _1 <= _3 && _1 <= _2) { // Is 1 the minimum?
|
||||
System.out.println("minimum= " + _1);
|
||||
} else if (_2 <= _4 && _2 <= _3 && _2 <= _1) { // Is 2 the minimum?
|
||||
System.out.println("minimum= " + _2);
|
||||
} else if (_3 <= _4 && _3 <= _2 && _3 <= _1) { // Is 3 the minimum?
|
||||
System.out.println("minimum= " + _3);
|
||||
} else { // All other conditions failed, _4 must be the minimum
|
||||
System.out.println("minimum= " + _4);
|
||||
}
|
||||
scan.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user