Answer to Question #246176 in Java | JSP | JSF for Aubrey Eso Jozela

Question #246176
Building name: Engineering Venue number: 2.38 Number of seats: 80 3 Write the method problemVenue() for the Venue class. This method returns the boolean value false. ComputerLab class Code the attributes and methods as per diagram for the ComputerLab class. 1 Remember to call the superclass constructors in the coding of the ComputerLab constructors. 2 Remember to call the superclass toString() in the ComputerLab toString(). 3 Code the show() method. This method is void and displays the details of a ComputerLab object. Again, remember to call the show() of the superclass. Building name: Engineering Venue number: 1.24 Number of seats: 40 Number of working computers: 35 4 Code the method problemVenue. This method returns a boolean value of true if the numberSeats in the computer lab is more than the numberWorkingComputers, else a boolean value of false is returned.
1
Expert's answer
2021-10-03T16:17:42-0400
//main class name, "DominantDemo"
public class DominantDemo {
    //Method definition of "dominant"
    public static boolean dominant(int first, int second, int third) {
        // Checks whether the first number is greater
        //than the sum of the other two variables. If it
        //is correct then returns true.
        if (first > (second + third))
            return true;
        // Checks whether the second number is greater
        //than the sum of the other two variables. If it
        //is correct then returns true.
        else if (second > (first + third))
            return true;
        // Checks whether the third number is greater
        //than the sum of the other two variables. If it
        //is correct then returns true.
        else if (third > (first + second))
            return true;
        // Since, none of the number is greater than the
        //sum of the other two variables, return false.
        else 
            return false;
    }
    /*****************************************************
     * The main method is used to call the dominant() *
     * method and store the return value in ans. Finally, *
     *it prints the value stored in ans is true or false. *
     *****************************************************/

    // Create a main() method to call the dominant() method
    //and display the result.
    public static void main(String[] args) {
        //Call the function
        boolean ans = dominant(4, 9, 2);
        //Display output
        System.out.println(ans);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS