Identify when you would use if-else statement in programming

Assignment Help JAVA Programming
Reference no: EM131930889

Assignment

1) In Java, a data structure is a particular way of organizing data so that it can be used efficiently. An array is a Java data structure. Define an Array and why you would use one. Provide an example that is not from the text.

What is the output of the following array code fragment:

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };
for ( int index= 0 ; index < 5 ; index++ )
System.out.print( egArray[ index ] + " " );

• 2 4 6 8
• 2 4 6 8 10
• 2 4 6 8 10 1
• 2 4 6 8 10 1 3 5 7 9

2) Java provides three repetitions structures: while, do while and for. These statements are also known as loops. When would you use a looping statement? Share an example where a looping statement is needed.

Consider the Java code below, indicate the output that will be produced:

final int MIN = 10, MAX = 20; int num = 15;
while (num < MAX)
{
num = num + 1;
System.out.println (num):
}

3) Provide the definition of an If-Else statement. Identify when you would you use an If-Else statement in programming.

Consider the Java code below:
if (x > 5)
{
System.out.println("A");
if (x < 10)
System.out.println("B");
}
else
System.out.println("C");
What is displayed if x is:
• 4;
• 5;
• 6;
• 9;
• 10;
• 11.

Reference no: EM131930889

Questions Cloud

Discuss the motivation of people who keep quiet : Discuss the motivation of people who keep quiet and struggle with dispensing bad news.
Discuss the motivation of people who keep quiet : Discuss the motivation of people who keep quiet and struggle with dispensing bad news.
Describe how the brain has been implicated in schizophrenia : Describe how the brain has been implicated in schizophrenia. Describe the clinical symptoms of schizophrenia, including positive, negative, and disorganized.
What was the result of your political ideology quiz : What was the result of your political ideology quiz? Do the results of the quiz give an accurate or adequate representation of your political position?
Identify when you would use if-else statement in programming : Provide the definition of an If-Else statement. Identify when you would you use an If-Else statement in programming.
Supply chain ethics when they purchase apparel : Do you believe that consumers consider a brand's supply chain ethics when they purchase apparel?
Marketers to implement with regards to seo : That is, if you were a SEO consultant for a small business owner, what three tips would you insist that the entrepreneur immediately change on his website?
Write program to read phone call records from a file : CSC 2430 LAB 1 - Phone Calls Processing - Your assignment is to write a C++ program to read in a list of phone call records from a file
Compile an annotated bibliography : HRMT20024 T1 2018 - Assessment 2 Annotated Bibliography Guidelines - identify which sector you will study for Assessments 2

Reviews

Write a Review

JAVA Programming Questions & Answers

  Determine the distance to it from lancre

Project – methods - The program keeps asking for input until the user enters a valid city. Account for errors in capitalization, i.e. QUIrm and quirm and qUirm

  Evaluate the average temperature for the month

Write a program that stores the daily temperatures for the month of April in an array name dailytemp. Evaluate the average temperature for the month and the count the number of days

  Program in java for the evaluation of infix expression

Write a program in java for the evaluation of infix expression in java which is fully parenthised.

  Build an android application to execute some of the queries

Build an android application to execute some of the queries -

  Execute the internal loop of the method

The parameter shall determine how many times to execute the internal loop of the method. Within the loop the method

  Generate an array of random integers from zero to nine

Generate an array of 20 random integers from zero to nine. Search for the first occurrence, if any, of the number 7, and report its position in the array

  Total grade for n classroom exercises

Create a program that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed

  What does the program segment print

What does the statement print - What does the following statement output - What does the program segment print

  Multi-threading concepts

Multi-threading concepts: What is the output of the following program? class Threading{

  Create a java class called student

Create a Java class called student with the following instance variables: private String studentName

  Wite a java application that allows the user to read

write a java application that allows the user to read validate store display sort and search the account

  What is the smallest exponent

In storing number in a string of 16 bits, the first bit is used for the sign of the number, and the next 5 bits store the exponent plus the bias, and the remaining 10 bits store the mantissa. The bias is 15.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd