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
Elenna [48]
3 years ago
9

Write an if-else statement to describe an object. Print "Balloon" if isBalloon is true and isRed is false. Print "Red balloon" i

f isBalloon and isRed are both true. Print "Not a balloon" otherwise. End with newline.import java.util.Scanner;public class RedBalloon {public static void main (String [] args) {boolean isRed = false;boolean isBalloon = false;using java from there
Computers and Technology
1 answer:
Marat540 [252]3 years ago
6 0

Answer:

if(isBalloon== true && isRed==false) //compare the value of isBalloon variable with true value and isRed variable value with false value.

   System.out.println("Balloon");//Print Balloon

else if(isBalloon== true && isRed==true) //compare the value of isBalloon variable with true value and isRed variable value with also true value.

System.out.println("Red balloon");//Print Red  Balloon

else // when no if condition match it will execute.

System.out.println("Not a balloon"); //Print Not a Balloon

Output:

Not a balloon

Explanation:

The "if-else" statement is defined above for the problem which is given on the question. The detailed explanation of the answer is described below--

  • Firstly we need to check the "true" value for the "isBalloon" variable and "false" value for "isRed" variable. This is done in "if" statement separated with and(&&) operator which gives "true" when both are the true statement.
  • Then we need to check the "true" value for the "isBalloon" variable and "isRed" variable. For this, we need to use "else if" statement which executes when "if" statement is false.
  • Then we need to print the "Not a balloon" statement if both cases are false, for this, we use "else" statement which executes when the "if" and "else if" statement are false.

You might be interested in
A 10 Superscript negative 910−9​-F capacitor ​(11 nanofaradnanofarad​) is charged to 5050 V and then disconnected. One can model
vredina [299]

Answer:

Explanation:

i) On a cold day, Capacity = (66 X 910 X 10∧-9) F

Charge, Q = (66 X 910 X 10∧-9) X 5050 = 0.30 Columb

Current, I= 5050/131013 = 0.039 Amp (where Resistance = 131013 ohms)

Time, t= 0.30/0.039 = 7.7 seconds

ii) On a humid day, Capacity = (77 X 910 X 10∧-9) F

Charge, Q = ( 77 X 910 X 10∧-9) X 5050 = 0.35 Columb

Current, I= 5050/6106 = 0.83 Amp ( where Resistance = 6106 ohms)

Time, t= 0.35/0.83 = 0.42 h or  0.42 X 60 mins = 25 mins

7 0
3 years ago
The language C was originally developed by​
nataly862011 [7]

Answer:

Dennis Ritchie

C was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to make utilities running on Unix

3 0
3 years ago
Read 2 more answers
B. List any four major drawbacks of the first generation computer​
d1i1m1o1n [39]

Answer:

Terribly low storage space, limited to mathematics/computing, required entire rooms to use, and low information yield for hours of processing.

Explanation:

3 0
2 years ago
How does a color change if you add more gray to it
Tom [10]
Gray isn't a color to be exact it a shade or what some people call it a shadow just like black but if you add more gray to a look lets say RED it will make it kinda faddy and more darker then it was

6 0
2 years ago
The filter feature in excel allows you to look at what Data?
madam [21]

For applying the filter you need to select the data on which you want to apply it so it will allow you to look at only data you select from the filter options.

4 0
2 years ago
Other questions:
  • You work in a classified environment where Bell LaPadula MLS (Multilevel Security) model is employed. Your clearance is "SECRET"
    5·1 answer
  • Peter has a website that promotes his local vacation rental site. He uses Google Ads to manage his advertising campaign. He’s cr
    13·1 answer
  • In a chassis, the path along which air from a cool air source is conducted, past equipment to cool it, and then out of the rack.
    13·1 answer
  • How do i do a class in java??
    5·1 answer
  • What is the result of executing the following code? You can assume the code compiles and runs. #include using namespace std; voi
    6·1 answer
  • 8. A sprite is a simple spider shaped thing with n legs coming out from a center point. The angle
    10·1 answer
  • Imagine a machine that produces an output force that is five times larger
    11·1 answer
  • The method used to transfer information to far off place instantly is called​
    13·2 answers
  • Which is a software application used to analyze an organization’s data to improve decision making?
    11·1 answer
  • The _________________ creates international guiding principles for computer forensic examiners.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!