Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; public class MinMax { // TODO - write your code below this comment. // You need to write two methods: min and max.
import java.util.Scanner; public class MinMax { // TODO - write your code below this comment. // You need to write two methods: min and max. // min should take two ints and return the smaller one, // and max should take two ints and return the larger one. // If the two ints given are the same, then they can return // either one. // // As a hint, you will need to use if/else, along with // a comparison of some sort between the two given ints. // DO NOT CALL Math.min OR Math.max! // DO NOT MODIFY main! public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter first integer: "); int first = input.nextInt(); System.out.print("Enter second integer: "); int second = input.nextInt(); System.out.println("Min: " + min(first, second)); System.out.println("Max: " + max(first, second)); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started