1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Cloud [144]
4 years ago
13

Write a java program making use of methods that finds the smallest of any three numbers that the user inputs. You must use Jopti

onPane to input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.
Computers and Technology
1 answer:
laila [671]4 years ago
8 0

Answer:

import javax.swing.JOptionPane;

public class num3 {

   public static void main(String[] args) {

       String val1 = JOptionPane.showInputDialog("enter first number","value1");

       int num1 = Integer.parseInt(val1);

       String val2 = JOptionPane.showInputDialog("enter second number","value2");

       int num2 = Integer.parseInt(val1);

       String val3 = JOptionPane.showInputDialog("enter third number","value3");

       int num3 = Integer.parseInt(val1);

       //Calling findMin Method

       int minimum = findMin(num1,num2,num3);

       //Calling printMin to print the minimum

       printMin(minimum);

   }

   public static int findMin(int num1, int num2, int num3){

       int min;

       if (num1<num2&&num1<num3){

         min = num1;

       }

       else if(num2<num1&& num2<num3){

           min = num2;

       }

       else{

           min = num3;

       }

       return min;

   }

   public static void printMin(int n){

       JOptionPane.showMessageDialog(null, "The minimum is "+n);

   }

}

Explanation:

  • Import javax.swing.javax.swing.JOptionPane;
  • Use the input dialog method to receive three values
  • convert these values to integers using the Integer.parseInt method
  • Create the method findMin () which uses if and else statements to find the minimum of the three numbers
  • Create method printMin which uses the showMessageDialog method to print the minimum value
  • Call both methods in the main method

You might be interested in
What settings are available in the Properties dialog box of a message? Check all that apply.
Reptile [31]

Answer:

A,D,E,F

Explanation:

edg2021

8 0
3 years ago
Read 2 more answers
What is Napoleon's friend's full name? From the Napoleon Dynamite movie.
expeople1 [14]

His friend's full name was Pedro Sanchez :)

7 0
3 years ago
Read 2 more answers
Angela and Jose saved files to a USB drive as well as on their computers' hard drive. A Angela and Jose saved files to a USB dri
zvonat [6]
The answer is:
D. Only Jose is correct


When the two files are saved in different locations they are new and different files, not the same. If you change one it wont change the other.
4 0
3 years ago
As a student, why do you need to know and follow the steps printing a <br><br>document?​
Kazeer [188]
So I am able to print my math notes and keep up in geometry.
7 0
3 years ago
Read 2 more answers
4. What is the formula for calculating the file size?
Verizon [17]
Step 2: Multiply total number of pixels by the bit depth of the detector (16 bit, 14 bit etc.) to get the total number of bits of data. Step 3: Dividing the total number of bits by 8 equals the file size in bytes. Step 4: Divide the number of bytes by 1024 to get the file size in kilobytes.
7 0
3 years ago
Other questions:
  • What products use fabric manipulation
    8·1 answer
  • Which of the following is a useful policy to minimize waste and mistakes?
    6·1 answer
  • Order the following list of functions by the big-Oh notation. Group together those functions that are big θ of one another.6nlog
    5·1 answer
  • The dramatic increase in the number of people having access to the Internet has been made possible, in part, because of the rela
    8·1 answer
  • What is considered to be the core of the Unix operating system ?
    14·1 answer
  • Charlie makes pizza at a restaurant. The customers always compliment how great the pizza tastes. But Charlie takes a long time t
    7·2 answers
  • 1.) Explain one way the internet has impacted the way we behave.
    7·2 answers
  • Why do you think it is important to know typography and color when designing web sites?
    15·2 answers
  • ? Question<br> How are the Internet and the World Wide Web different from each other?
    11·1 answer
  • 100 POINTS!!!!!!!!
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!