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
Strike441 [17]
4 years ago
5

Given the integer variables x and y, write a fragment of code that assigns the larger of x and y to another integer variable max

.
Computers and Technology
1 answer:
Sidana [21]4 years ago
7 0

Answer:

if ( x > y ) {

    max = x;

}

else {

    max = y;

}

Explanation:

Assumptions:

(i) Variables x, y and max have been defined.

(ii) Since the question does not specify what to do if x and y are equal, I have assumed no such case exists. i.e x and y are never equal.

PS : The code has been written in Java.

According to the question, the larger of variables <em>x</em> and <em>y</em> is assigned to another variable, <em>max.</em>

To check which of x and y is greater, we could use an <em>if...else</em> statement like so;

if ( x > y ) {      // check if x is greater than y

  max = x;      // if yes, assign the value of x to max

}

else {             // then y is greater

 max = y;      // assign the value of y to max

}

You might be interested in
6. Which of the following options is used to view a computer's memory properties?
pentagon [3]
There is an option used to vew a computer's memory properties by just simply opening your My computer directory. There you can see different names of your hard drive, there you choose what hard drive you want to view by just right clicking it and choosing properties. There you will see it's memory space.
3 0
4 years ago
Who invented autonomous cars? When I look it up it comes up as William Bertelsen but he invented the idea of hovering cars. Help
Diano4ka-milaya [45]
The answer is Carnegie Mellon.
4 0
3 years ago
Ryan wants to ensure that all the words in this document are evenly spaced so that they look neat and readable . Which option in
natka813 [3]
To achieved a document that is evenly spaced so that they look neat and readable, the option in a word processing program will help to achieve this is the home setting. In the home of the word, you can see there various tabs, one of the tabs is the paragraph. You will click symbol of "justify". And there is simple code to do that, just press the "Ctrl" and "J" on your keyboard at the same time.
5 0
3 years ago
.Statements using the ___________ class are explicit conversions.
USPshnik [31]

Answer: Explicit

Explanation:

 The statement which used the explicit class are the explicit conversion, as  it is type of the conversion which uses the conversion keyword. These type of the keywords act as a function in the explicit conversion and compiler generating the code in the given inline function.  

Explicit conversion basically require the cast operator in its function when, the information is lost during explicit conversion.

Conversion of base class into the derives class is one of the typical example of the explicit conversion.

3 0
3 years ago
Help please?
Paraphin [41]
Hmmmm. I believe it would be scroll bars. I'm not in technology class but that's my best guess
7 0
4 years ago
Other questions:
  • What is the Web of Trust?
    12·1 answer
  • Power point 2016 which chart element provides the boundaries of the graphic?
    6·1 answer
  • Write a program that reads from user (i) an hour between 1 to 12 and (ii) number of hours ahead. The program should print the ti
    15·1 answer
  • 1. If you are 15% years old, you are old enough to obtain
    10·2 answers
  • _____ is a technique that combines the strongest features of Wired Equivalent Privacy (WEP) and Extensible Authentication Protoc
    11·1 answer
  • Which is an example of a tertiary source?
    13·1 answer
  • Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p
    14·1 answer
  • Are scripted languages easier or more difficult to port than programming languages? Why?
    6·1 answer
  • .13 LAB: Library book sorting Two sorted lists have been created, one implemented using a linked list (LinkedListLibrary linkedL
    14·1 answer
  • Question # 2 Multiple Select You wrote a program to compare the portion of drivers who were on the phone. Which statements are t
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!