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
jeka94
3 years ago
10

What will be the value of ans after the following code has been executed?

Computers and Technology
2 answers:
Leno4ka [110]3 years ago
8 0

Answer:

B) 120

Explanation:

In the first three lines of the code, three variables ans, x and y have been declared and initialized;

=> ans = 10;

=> x = 65;

=> y = 55;

On the fourth line and fifth line of the code, there is an if block statement that will get executed if the value of x is greater than or equal to that of y;

i.e

     if (x >= y)

       ans = x + y;

And since x = 65 and y = 55, it implies that x is greater than or equal to y.

Therefore the fifth line of the code will be executed

=> ans = x + y

=> ans = 65 + 55

=> ans = 120

Note:

<em>Though the value of variable </em><em>ans </em><em>was initially 10 before the execution of the if statement, its new value </em><em>120</em><em> will replace the former value.</em>

<em />

Therefore the value of ans after the code has been executed is 120

Lesechka [4]3 years ago
7 0

Answer:

Option B 120

Explanation:

There are three variables,<em> ans, x </em>and <em>y</em> given in the code. In beginning, the variable. <em>ans,</em> holds value of 10.  And variable <em>x</em> and <em>y</em> hold value of 65 and 55, respectively. Since the value held by x is bigger than one held by y, the if condition is met and the statement ans = x + y will run. The execution of this statement will total x with y -> 65 + 55 and the initial value of <em>ans is </em>overwritten by the addition result which is 120.

You might be interested in
You are between flights at the airport and you want to check your email. Your wireless settings show two options:
Likurg_2 [28]
The correct answers Is B
8 0
3 years ago
A folder can contain only files? A. True B.False
choli [55]
That statement is true.
In recent technologies, folder can contain whatever users want it to contain.  Not only, that, users could also arrange the maximum size of files that a folder could contain or the visibility status of each items that will be placed on the shoulder in case they need some sort of privacy for his/her files

8 0
3 years ago
Read 2 more answers
On the following page, write a static method print Short Words that accepts two parameters:_____.
barxatty [35]

Methods in Java are collections of program statements that are named, and executed when called/invoked

The printShortWords method in Java where comments are used to explain each line is as follows:

//This defines the static method

public static void printShortWords(String str, int maxLength){

    //This iterates through each word in the string

    for(String word: str.split(" ")){

        //The compares the length of each word to maxLength

        if(word.length()<=maxLength){

            //If the length of the current word is atleast maxLength, the word is printed

        System.out.print(word+" ");

        }

    }

}

Read more about static methods at:

brainly.com/question/19360941

7 0
2 years ago
The labor market shows the:
Bad White [126]
<span>The labor market shows the </span><span>supply of available workers in relation to available work. The labor market is made up of </span>people who are working or looking for work. Those who are actively searching for work are calculated in the labor market as well. Those who are able to work but are not searching for work are not part of the labor market. 
8 0
3 years ago
• Open your Netbeans IDE and answer the following question
VARVARA [1.3K]

Answer:

public static void main(String[] args)

   {

       int cdCount;

       double cdCountAfterDiscount;

       DecimalFormat df = new DecimalFormat("$##.##"); // Create a Decimal Formatter for price after discount

       System.out.println("Enter the amount of CD's bought");

       Scanner cdInput = new Scanner(System.in);  // Create a Scanner object

       cdCount = Integer.parseInt(cdInput.nextLine());  // Read user input

       System.out.println("CD Count is: " + cdCount);  // Output user input

       if(cdCount <= 14 )

       {

           System.out.println("There is no discount");

           System.out.println("The final price is " + cdCount*3.5);

       }

       if(cdCount >= 15 && cdCount<=50)

       {

           System.out.println("You have a 1% discount.");

           cdCountAfterDiscount = (cdCount *3.5)-(3.5*.01);

           System.out.println("The final price is " + df.format(cdCountAfterDiscount));

       }

       if(cdCount >= 51 && cdCount<120)

       {

           System.out.println("You have a 5% discount.");

           cdCountAfterDiscount = (cdCount *3.5)-(3.5*.05);

           System.out.println("The final price is " + df.format(cdCountAfterDiscount));

       }

       if(cdCount >= 120)

       {

           System.out.println("You have a 10% discount.");

           cdCountAfterDiscount = (cdCount *3.5)-(3.5*.1);

           System.out.println("The final price is " + df.format(cdCountAfterDiscount));

       }

   }

8 0
3 years ago
Other questions:
  • The Modified Greiss chemical test is used to detect the presence of what chemicals that indicate muzzle to target distance?
    11·1 answer
  • Clifford visits a website that has a lot of multimedia content. He watches a few videos. However, some videos do not play. The b
    14·1 answer
  • In Labrador retrievers, black coats are dominant and brown coats are recessive. What is the genotype of a brown Labrador?
    5·1 answer
  • An electronic device that can accept data as input, process it according to a program, store it, and produce information as outp
    6·1 answer
  • Creating a Graphical User Interface in Java
    11·1 answer
  • Select the correct answer. Which of these statements is an explorer most likely to make?​
    6·1 answer
  • You have heard that it is possible to improve your computer's performance by storing all related files for a particular program
    9·1 answer
  • What does a capitalist economy allow people to do?
    11·2 answers
  • What is stored in studentScores after running the program code?
    5·1 answer
  • Sumit has created a procedure to draw a boat in Logo and saved it by the name, 'Boat'. Next day, when he tried to type the name
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!