answersLogoWhite

0

The If else if construct is usually used when a series of conditions need to be validated or checked one by one.

Say for example you are writing a program to decide on projected weight of a person then you may need to have an if - else if block.

If height > 4 feet then

weight should be atleast 40 kgs

else if height > 5 feet then

weight should be atleast 50 kgs

else if height > 6 feet then

weight should be atleast 60 kgs

and so on...

Example code.

This method takes the height in inches as input and returns weight in kilograms as output.

public int getMinWeight(int height){

if(height > 4) {

return 40;

} else if(height > 5){

return 50;

} else if (height > 6){

return 60;

} else {

return 70;

}

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

With illustrative example explain how Operating System Programming Language Hardware support the Computer Graphics?

With illustrative example explain how Operating System Programming Language Hardware support the Computer Graphics?


Explain pointer to function with example c language?

It isn't a question, sorry.


What does construct mean in math?

it means make something for example: construct a triangle then you would make a triangle.


What is a example of adaptations?

Spiders are an example of adaptation. They construct webs to catch prey.


What is user define datatype and explain it?

Any datatype which the user creates in code, that isn't native to the language. A linked list can be an example of this


What is string variables?

A string variable is a programming language construct that holds text. For example, the text "The sky is blue" could be stored to a string variable, then later in the program, that text could be displayed.


Is vbnet a SOA programming language or Object Oriented Programming Language?

Visual Basic is an Object oriented programing language, like C++. A good example of an SOA program language is C#. can you explain with reasons........? i agree with you .... I want to confirm the reason why it is so ...


What is repeat loop?

Most programming languages have some loop construct, that make it possible to repeat commands several times. The available commands vary, depending on the language; as an example, Java has the "for", "while", and "do...while" keywords.


What are conditional connectives. Explain with an example?

What are conditional connectives? Explain use of conditional connectives with an example


What is bcnf explain with example?

define BCNF. Explain with appropriate example


What are the benefits of measures of central tendency Explain with an example?

"What are the benefits of measures of central tendency? Explain with an example


Explain with help of an an example how FAT different from inode?

explain with help of an example, how FAT is different from inode.