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
Write a simple algorithm in pseudocode that asks the user their favourite colour and then agrees with their choice, quoting the
olga55 [171]

Answer:

i am still a beginner in this but i hope it helps.

  • add scanner object;
  • declare string FavColour;
  • print msg to ask user for input
  • scan input FavColour;
  • print msg (" your favourite colour is " + FavColour)

3 0
3 years ago
Adding _______ around calculations indicates which calculations should be performed first before following the typical order of
Finger [1]

Adding parenthesis around calculations indicates which calculations should be performed first before following the typical order of operations. Correct answer: DThe order of operations is the order in which all algebraic expressions should be simplified is the following: First should be calculated expressions with parentheses, then exponents (and Roots) means power , then multiplication & Division and at the end Addition & Subtraction.

5 0
3 years ago
Read 2 more answers
The default page orientation in a microsoft excel worksheet is landscape true false
kobusy [5.1K]
To answer your question it is false. This is because excels default orientation is portrait
6 0
3 years ago
3-5 paragraphs on how and why robotics are used in nuclear fields
Dmitriy789 [7]
Robots can be used in fabrics where they now use them to help do the work faster and do somethings that humans cant do.
3 0
4 years ago
Read 2 more answers
Computers are not just stand-alone desktop machines anymore. They are often embedded in common appliances and technology that we
Mila [183]
A DVD does not have a computer in it.
4 0
4 years ago
Read 2 more answers
Other questions:
  • What does iSCSI stand for?
    5·2 answers
  • Why isn't my rank move from ambitious to virsto i met all the requirements
    8·2 answers
  • I need a free flashdrive can anyone tell me any website links so i can get one for free????​
    11·1 answer
  • When an ethernet nic has been configured by os to use half-duplex, the transmit pair of the twisted-pair cable uses?
    8·1 answer
  • The ________ utility automatically creates duplicates of your libraries, desktops, contacts, and favorites to another storage lo
    7·1 answer
  • What is the correct process for inserting a blank worksheet in Google sheets
    12·1 answer
  • Normal wear and road conditions can take their toll on a car’s steering and suspension system, altering __________. A. wheel ali
    15·2 answers
  • William found out that someone used his report on american culture without his permission. what is william a victim of?
    11·1 answer
  • The arguments in a method call are often referred to as ____ . The variables in the method declaration that accept the values fr
    10·1 answer
  • Ninety percent of the fastest-growing jobs require some kind of postsecondary education.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!