Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

1. Write down two or three of your greatest strengths.

Answered: 1 week ago

Question

Assessment of skills and interests.

Answered: 1 week ago

Question

Psychological, financial, and career counseling.

Answered: 1 week ago