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
Assignment 4: Evens and Odds<br><br><br> How do I fix this?
skelet666 [1.2K]

There's definitely something wrong with your for loop. Try this:

for x in range(n):

You might want to check if all your print statements are correct. You might be missing just a period and it will be counted wrong.

6 0
3 years ago
Which word processing file that contains text and other
Oksi-84 [34.3K]

Answer:

B . document

Explanation:

Word document contains text, table, picture and more. Word document is a file of .doc, .docx etc format

Table, ribbon or keyboard can't be classed as a file and they are elements of a file, menu or hardware

<u>So correct option is</u> B. Document

7 0
3 years ago
Read 2 more answers
What is the default zoom percentage in Word?<br><br> 50%<br> 100%<br> 150%<br> 200%
Hunter-Best [27]

Answer:

its 100%

Explanation:

5 0
3 years ago
Read 2 more answers
There are over 150 free themes on Wordpress.com. Which of the following is a common feature for which you can filter your theme
Oduvanchick [21]

Answer:

A responsive layout is usually a common and important aspect of a theme since it can allow users to use different devices and receive a proper satisfactory visit.

Explanation:

Depending on the purpose of the site, you need to be decided what functionalities you deem necessary and which are just useful in case you might need it later on. Example

A blog site will required a good blog theme,

including one that has ecommerce options depends weather the blogger might be thinking of selling things or not.

8 0
3 years ago
Select below the Active Directory server role that provides the functions of Active Directory without the requirements of forest
sasho [114]

Answer:

​AD DS

Explanation:

Active Directory Domain Service is an active directory server role found in windows server and it permits admins in a network environment store and also manages information from a particular source in a network, there are no requirements for forests, domains, and domain controllers. It works both on intranet and internet networks.

3 0
4 years ago
Other questions:
  • Why is it critical to provide proper treatment for minor and moderate sports injuries within the first 48 hours after sustaining
    14·1 answer
  • In c++
    9·1 answer
  • A computer with more than one operating system installed is referred to as a _____ system.
    13·1 answer
  • What is the purpose of a mail merge field.
    14·1 answer
  • Cultural competence​ involves
    12·1 answer
  • Engineers use science to ______ things that people use.
    13·1 answer
  • What are the answers for edhesive quiz 2? I can’t add more than 1 photo...
    11·1 answer
  • Which of these did the author use to create certain moods?
    6·1 answer
  • Who wants 100 points? comment buh. i don't rlly care buh.
    15·2 answers
  • Systems management involves allocation of computer resources to keep all processes operating smoothly and at maximum efficiency.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!