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
sesenic [268]
3 years ago
10

Write a Bare Bones program that takes as input two variables X and Y. (Again, assume these values are set before your program be

gins to execute.) Your program should place a 0 in the variable Z if the variable X is less than or equal to Y, and your program should place a 1 in the variable Z if the variable X is greater than Y.
Computers and Technology
2 answers:
Sauron [17]3 years ago
5 0

Answer:

import java.util.Scanner;

public class num8 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter first number");

       int X = in.nextInt();

       System.out.println("Enter second number");

       int Y = in.nextInt();

       int Z;

       if(X <= Y){

           Z = 0;

       }

       else if(X >= Y){

           Z = 1;

       }

   }

}

Explanation:

  • The program is implemented in Java
  • In order to set the values for X and Y, The Scanner class is used to receive and store the values in the variables (Although the questions says you should assume these values are set)
  • The if conditional statement is used to assign values (either 0 or 1) to variable Z as required by the question.
ratelena [41]3 years ago
3 0

Answer:

#The program sets Z to 0 if the X <= Y. otherwise sets Z to 1 , if the X > Y.

clear Z; # sets Z to 0

clear U; # sets U to 0

clear V; # sets v to 0

clear T; # sets T to 0

while Y not 0 # repeat until Y times

# process to decrement Y by 1

while Y not 0

incr U;

decr Y;

decr U;

while U not 0

incr Y;

decr U;

#process to decrement X by 1

while X not 0

incr V

decr X;

while V not 0

decr V;

while V not 0

incr T;

decr V;

while T not 0

incr X

decr T

#end of main while loop

#after running the main while loop, X will be positive and non - zero number, # #if X > Y. otherwise X and Y will be zero.

#process to increment Z by 1, if X is positive and non - zero number

while X not 0

while X not 0

decr X;

incr Z;

#end of while

Explanation:

The program is totakes in as input two variables X and Y.

The main function of the program is to return or place a 0 in the variable Z if the variable X is less than or equal to Y, and place a 1 in the variable Z if the variable X is greater than Y.

When these conditions are met, end program.

You might be interested in
Copyrighted software that is distributed at no cost for a trial period is called?
Alex
Copyrighted software that is distributed at no cost for a trial period is called Shareware.
8 0
4 years ago
You want to search for contacts in your email program. You enter the person’s first name and last name in the search box. You wa
ryzh [129]

Answer:

NOR

Explanation:

6 0
3 years ago
Read 2 more answers
Any information that is processed by and sent out from a computer or other electronic device is considered __________.
wel

Answer:

Your answer will be output.

Hope this helps!

3 0
3 years ago
Read 2 more answers
A Turing machine with doubly infinite tape (TMDIT) is similar to an ordinary Turing machine except that its tape is infinite to
umka2103 [35]

Answer and Explanation:

A TM with doubly infinite tape can simulate an ordinary TM. It marks the left-hand end of the input to detect and prevent the head from moving off of that end. To simulate the doubly infinite tape TM by an ordinary TM, we show how to simulate it with a 2-tape TM, which was already shown to be equivalent in power to an ordinary

TM. The first tape of the 2-tape TM is written with the input string, and the second tape is blank. We cut the tape of the doubly infinite tape TM into two parts, at the starting cell of the input string. The portion with the input string and all the blank spaces to its right appears on the first tape of the 2-tape TM. The portion to the left of the input string appears on the second tape, in reverse order.

3 0
3 years ago
How many report charts can be added to the account page layout to meet this requirement? A sales manager would like to look at a
Virty [35]

Answer:

D - 2

Explanation:

You can have two report charts per page. You can only add report charts from the enhanced page layout editor.

The mini console and the original page layout editor are not supported. On detail pages, users can refresh up to 100 report charts every 60 minutes. Your organization can refresh up to 3,000 report charts every 60 minutes

8 0
3 years ago
Other questions:
  • T<br> F<br> 5.<br> You can save presentations in PDF and XPS formats.
    14·1 answer
  • Whenever I try to plug in my code it will not work. I also need to add 4 more polygons and I don't know where.
    11·1 answer
  • Which type of computer do dedicated gamers and video editors prefer?​
    11·1 answer
  • In 1928 what film was the first all talking feature
    12·1 answer
  • According to the presentation, integrity and ethics are particularly important for careers in which of the following pathways?
    5·1 answer
  • Jeremy is working with a team that is creating an application using attributes and associated methods. What type of programming
    8·1 answer
  • Why do the Brainly ads not end even after the timer reaches 0? Sometimes the Done Button does not appear.
    5·2 answers
  • Alex has composed a layout with this Image for a magazine. Which rule of composition has Alex applied?
    14·1 answer
  • Write a for loop that displays the following numbers exactly like this (you must use a loop):
    15·2 answers
  • ____ includes) all tools that capture, store, process, exchange, and use information.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!