Question

Java Programming Write a program called “LargestNumber”, that compares below three numbers and prints out the...

Java Programming

Write a program called “LargestNumber”, that compares below three numbers and prints out the largest number. Num1 = 10, Num2-15, Num3=20. 1. You must use “If/else” logical statement to compare the three numbers.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class LargestNumber {

    public static void main(String[] args) {
        int Num1 = 10, Num2 = 15, Num3 = 20;
        if (Num1 >= Num2 && Num1 >= Num3) {
            System.out.println(Num1);
        } else if (Num2 >= Num1 && Num2 >= Num3) {
            System.out.println(Num2);
        } else {
            System.out.println(Num3);
        }
    }
}

Add a comment
Know the answer?
Add Answer to:
Java Programming Write a program called “LargestNumber”, that compares below three numbers and prints out the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You have three integers (num1, num2, num3). Write an if…else statement that given these 3 integers...

    You have three integers (num1, num2, num3). Write an if…else statement that given these 3 integers prints the largest on

  • So the assignment is to write a program that have the user entered 3 numbers and...

    So the assignment is to write a program that have the user entered 3 numbers and than it will sort it by ascending order. Here are the code I wrote, but it won't compiled and I kept on getting an error message "Using uninitiazed memory" for all the variables. Can someone please help take a look and see whats going on? #include <iostream> using namespace std; int main() { //variables int num1, num2, num3; int lowest, middle, highest; //user inputs...

  • Problem Description: Write s Java program to find and display the product of three integer values...

    Problem Description: Write s Java program to find and display the product of three integer values based on the rue mentioned below it should display the product of the three values except when one of thevalues is 7n that case 7 should not be ingluded in the product and the values to its left also shouid not be included If there is only one value to be considered display that value tself f no values can be included in the...

  • In Java, write a program called SCATTEREDLNS that prints out lines that contain a random number...

    In Java, write a program called SCATTEREDLNS that prints out lines that contain a random number of “x” characters (between 5 and 20 inclusive) until it prints a line that contains 16 or more characters. For example, it might look something like this xxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxx

  • Write a java program making use of methods that finds the smallest of any three numbers...

    Write a java program making use of methods that finds the smallest of any three numbers that the user inputs. You must use JoptionPane 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.

  • I want a program can read in three integers then prints out their sum and product...

    I want a program can read in three integers then prints out their sum and product and average for my input,it should have one or more lines of numbers that have been typed in by the user. Each line is to have exactly three real numbers.I would like to sue in.nextDouble() to read a number and after reading there doubles. how do i discard rest of spaces? for my output it should have for each line,the numbers that had been...

  • Java programming: Write a program called Distribution that reads a file of double values into an...

    Java programming: Write a program called Distribution that reads a file of double values into an array and computes and prints the percentage of those numbers within 1 standard deviation (SD), within 2 SDs, and within 3 SDs of the mean. The program should be modular and should at least contain the main method and a method for computing the above percentages given the numbers, the mean, and the standard deviation. Other required statistics should be computed in their own...

  • Write a program which: 1. Prints out the Multiplication Table for a range of numbers (positive...

    Write a program which: 1. Prints out the Multiplication Table for a range of numbers (positive integers). • Prompts the user for a starting number: say 'x' • Prompts the user for an ending number: say 'y' • Prints out the multiplication table of 'x' up to the number 'y' SPECIFIC REQUIREMENTS 1. You must use the following method to load the array: public static void loadArray(int table[][], int x, int y) 2. You must use the following method to...

  • JAVA. Write a program that reads in a series of positive integers and prints out the...

    JAVA. Write a program that reads in a series of positive integers and prints out the maximum value entered. The user will indicate they are finished entering numbers by entering zero or a negative integer.

  • Write a class called TemperatureFile. • The class has one data attribute: __filename • Write get...

    Write a class called TemperatureFile. • The class has one data attribute: __filename • Write getter and setter for the data attribute. • Write a “calculateAverage” function (signature below) to calculate and return average temperature of all temperatures in the file. def calculateAverage(self): • Handle possible exceptions Write a main function: • Create a file ('Temperatures.txt’) and then use “write” method to write temperature values on each line. • Create an object of the TemperaureFile with the filename (‘Temperatures.txt’) just...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT