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
Create and Provide complete program that includes a comments header with your name, course, section and other program details an
agasfer [191]

Answer:

Written using C++

/*Enter Your Details Here*/

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

//1

float side;

cout<<"Enter the side of a square: ";

//2

cin>>side;

//3

float perimeter = 4 * side;

cout<<"The perimeter is "<<perimeter<<endl;

//4

float area = side *side;

cout<<"The area is "<<area<<endl;

//5

float diagonal = sqrt(2 * side * side);

cout<<"The length of the diagonal is "<<diagonal;

return 0;

}

Explanation:

<em>I've added the full source code as an attachment where I used more comments to </em><em>explain </em><em>difficult line</em>

Download cpp
7 0
2 years ago
Write Java program to allow the user to input the amount of deposit, yearly interest rate (percentage), and income tax(percentag
Vedmedyk [2.9K]

Answer:

import java.util.Scanner;

public class num12 {

   public static void main(String[] args) {

       Scanner scr = new Scanner(System.in);

       System.out.println("Enter a Deposit Amount");

       double amt = scr.nextDouble();

       System.out.println("Income tax in percentage");

       double incomeTaxRate = scr.nextDouble()/100;

       System.out.println("Yearly interest rate:");

       double rate = scr.nextDouble();

       double intRate = rate/100;

       double interest = (amt*intRate)-(amt*incomeTaxRate);

       System.out.println("The Interest on "+amt+" at "+rate+"% after one year is "+interest);

   }

}

Explanation:

Find the sample output attached

Java's Scanner class is used to prompt and receive values for deposit amount, income tax rate and interest rate

The yearly interest is calculate by interest = (amt*intRate)-(amt*incomeTaxRate);

3 0
3 years ago
What is the disadvantage of a mesh topology?
-BARSIC- [3]

Answer:

Topology means arrangement of nodes

Explanation:

In computer science the word topology means the arrangement of nodes and elements in a network. For any topology we do need nodes and cables for maintaining the infrastructure.

In mesh topology the all nodes use to get connected by direct link. While each and every node is directly associated with  one another. In this infrastructure we do need lot cabling where every node will be connected with one another. While usage of good quality cable in network is  also expensive to manage. Although there are lot of benefits of this topology, where the transmission of data would never stop if node is not working the rest will be working to transfer the data among other nodes ,this is more secure because there is no traffic for data to travel via many nodes   to reach the destination. Every node is directly connected and communicate. So, once the node is not working the communication will not be stop but the maintenance and troubleshooting will be difficult in this infrastructure.

It is proved along with lot of benefits and network security ,this infrastructure is having some disadvantages as well. Cabling expense , maintenance cost etc  . usually small scale networks do not prefer mesh topology.  Small scale and low budget companies can  not afford this topology because it is expensive.

Although we do believe that the data security is most important for today's era ,so few companies those wanted to keep their information secure and confidential they must use mesh topology by ignoring the cost incurred for this set up. Data security and integrity would never be compromised by some of the companies.

Mesh topology is more safer, more quick infrastructure which is although very expensive , difficult to mange and maintain. Moreover it is overhead of cabling as well to connect every node but the demand of mesh topology would never be less. It is demanding and appealing topology still.

7 0
3 years ago
Read 2 more answers
A ________ allows users to add, remove, or edit its content.
Amanda [17]
Wiki is the correct answer
4 0
3 years ago
Read 2 more answers
Sweet thas 2 orange picks for every 5 green picks if there is 21 pick are in all how many picks are orange
Temka [501]

Your answer should be 9..

4 0
2 years ago
Other questions:
  • Truncation is a keyword search technique that helps you find useful variations of a term or terms. You want to find books on the
    5·1 answer
  • Is ubisoft still making assassins creeds on xbox 360
    8·2 answers
  • How neural networks impact our life??
    7·1 answer
  • Edhesive 3.2 Lesson Practice question 1
    5·1 answer
  • Which of the following statements about email is true?
    5·1 answer
  • Which of the following code is correct? I: print("Programming is fun") print("Python") print("Computer Science") II: print("Prog
    11·1 answer
  • Distinguish between exponentiation and modulus. Be specific.
    5·1 answer
  • What does it mean for a heap to be complete?
    7·1 answer
  • Ethan wants to change the font in his document. He should _____.
    8·1 answer
  • Examine the following output:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!