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
A research firm created a survey asking city residents about building a new city park. The firm will compile the results and cre
marysya [2.9K]

Answer:

A percentage

Explanation:

Percentage is used to measure or calculate the relationship between total amount and portion of that amount. 100 is set as a reference value.

<u>Example</u>

In our exam results, we obtain marks from total marks of that exam or activity. To Find the relationship between obtain marks and total marks we calculate the percentage by using following formula:

<em>Percentage Marks = obtain marks/Total Marks X 100</em>

<em />

<em>So In given case, the firm should calculate the percentage to compare the results.</em>

<em></em>

4 0
3 years ago
The options are
san4es73 [151]
Medicare Tax, Cause your providing options with no question attached. So i'm just giving my input of which im most concerned about.
5 0
3 years ago
Which of these statements are true? A. You can select all the items in the section of the menu. B. In the center section of the
Fofino [41]

Answer:

In the center section of the menu, only one item can be selected at a time.

Details is selected

Explanation:

7 0
4 years ago
What is a formula? What is a function? (In the context of Excel)
mel-nik [20]

Answer: A formula is an expression which calculate the value of a cell .A funcation is a predefined formula that performs calculations using specific values in particular order.According to context of excel.

4 0
4 years ago
David has created a lot of styles and now his Quick Style Gallery contains styles he no longer uses.
motikmotik

Answer:

Right-click the style in the Quick Styles Gallery, and select the Remove from Quick Style Gallery option

Explanation:

6 0
4 years ago
Read 2 more answers
Other questions:
  • A new company is upgrading a media workstation. The computer will be predominantly used for graphic intensive presentations, sli
    13·1 answer
  • If I wanted to share files only within my organization and limit my employees from sharing information with external people, wha
    13·1 answer
  • What size hard disc is recommended for powerpoint writting
    14·1 answer
  • If you owned an online clothing company and you only had the resources to run one social media campaign, which platform would yo
    14·1 answer
  • Which of the following dimensions of e-commerce technology has the potential to raise the quality of information? A) Global reac
    5·1 answer
  • Choose all of the items that represent operating systems largely derived from UNIX. GNU/Linux, Mac OS X, IBM, OS/360, BSD, Windo
    12·2 answers
  • What are html documents also called?
    12·1 answer
  • In what kind of attack can attackers make use of hundreds of thousands of computers under their control in an attack against a s
    7·2 answers
  • How you move the selection to a specific range by its name
    14·1 answer
  • John has recently retired from an administrative, yet technical job which he held for 40 years. He decided to pursue a life-long
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!