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
Anarel [89]
4 years ago
13

Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than

or equal to 65, and adds 1 to the variable nonSeniors otherwise. Assume all variables have been declared.
Computers and Technology
1 answer:
Sliva [168]4 years ago
7 0

Answer:

if( age>=65)

{

seniorCitizens=seniorCitizens+1;

System.out.println("seniorCitizens counting is="+seniorCitizens);

}

else  

{

nonSeniors=nonSeniors+1;

System.out.println("nonSeniors counting is="+nonSeniors);

}

Explanation :  

In the above java program, if age will be more than or equal to 65 so seniorCitizens counting will be increased by 1 and if it will be less than 65 so 1 will be increased in nonSeniors.

You might be interested in
what is the definition of web search(ing)? when I look it up it keeps trying to give me definitions for search engines but that'
AysviL [449]

Answer:

Web searching is when one types keywords into a search engine to retrieve data.

You're welcome.

6 0
4 years ago
Read 2 more answers
When performing actions between your computer and one that is infected with a virus which of the following offers no risk becomi
Mama L [17]

Going to need your answer choices

thanks :)

6 0
4 years ago
Imagine that you have access to a class named MyCircle that has void setRadius(double r) and double getRadius() methods. Write a
Nikitich [7]

Code for the method described in the question in java:

public static double averageRadius(MyCircle[] myCircles) {

       double sum = 0;

       for (MyCircle myCircle: myCircles) {

           if(myCircle.getRadius() < 0) myCircle.setRadius(0);

           sum += myCircle.getRadius();

       }

       return sum / myCircles.length;

   }

And the complete program:

import java.util.Random;

public class MyCircle {

   private double radius;

   public double getRadius() {

       return radius;

   }

   public void setRadius(double radius) {

       this.radius = radius;

   }

   public static double averageRadius(MyCircle[] myCircles) {

       double sum = 0;

       for (MyCircle myCircle: myCircles) {

           if(myCircle.getRadius() < 0) myCircle.setRadius(0);

           sum += myCircle.getRadius();

       }

       return sum / myCircles.length;

   }

   public static void main(String[] args) {

       Random random = new Random();

       int N = 10;

       MyCircle[] myCircles = new MyCircle[N];

       for (int i = 0; i < myCircles.length; i++) {

           myCircles[i] = new MyCircle();

           myCircles[i].setRadius(random.nextInt(100));

           System.out.printf("Created MyCircle %d with radius %.2f \n", i, myCircles[i].getRadius());

       }

       System.out.printf("\nAverage radius of %d circles is %.2f \n", N, MyCircle.averageRadius(myCircles));

   }

}

The output was:

Created MyCircle 0 with radius 76.00

Created MyCircle 1 with radius 86.00

Created MyCircle 2 with radius 38.00

Created MyCircle 3 with radius 4.00

Created MyCircle 4 with radius 8.00

Created MyCircle 5 with radius 39.00

Created MyCircle 6 with radius 77.00

Created MyCircle 7 with radius 78.00

Created MyCircle 8 with radius 39.00

Created MyCircle 9 with radius 46.00

Average radius of 10 circles is 49.10

7 0
3 years ago
1.Discuss the differences and similarities between a peer-to peer network and a client server network.
irga5000 [103]

Answer:

dsdasd1.Discuss the differences and similarities between a peer-to peer network and a client server network.

1.Discuss the differences and similarities between a peer-to peer network and a client server network.

1.Discuss the differences and similarities between a peer-to peer network and a client server network.

1.Discuss the differences and similarities between a peer-to peer network and a client server network.

1.Discuss the differences and similarities between a peer-to peer network and a client server network.

1.Discuss the differences and similarities between a peer-to peer network and a client server network.

1.Discuss the differences and similarities between a peer-to peer network and a client server network.

Explanation:

jaiusfkybuetcrjnwxyefshrcxijkwuecvashcnzx

5 0
3 years ago
What are the origins of the parking barrier?
Volgvan
Is there a photo we can see?
8 0
3 years ago
Other questions:
  • Match the following tasks with their appropriate timing.
    8·1 answer
  • Marjorie is a 72-year-old woman who is having difficulties with cooking and bathing. Jorge provides Marjorie with tools and tech
    12·1 answer
  • Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o
    11·1 answer
  • Name three actions you can perform on an inserted image.
    7·2 answers
  • Part 1 Create a program that asks the user for a temperature in Fahrenheit, and then prints the temperature in Celsius. Search t
    12·1 answer
  • A researcher wants to do a web-based survey of college students to collect information about their sexual behavior and drug use.
    7·1 answer
  • 2min speech on can teachers be replace by technology​
    5·1 answer
  • Savings accounts _____.
    15·1 answer
  • Who used the ICT in a report to UK government in 1997
    12·1 answer
  • MCQ: Which of the following network is confined to a relatively small area?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!