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
Tom [10]
3 years ago
10

(Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of int

egers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. Python
Computers and Technology
1 answer:
Papessa [141]3 years ago
7 0

Answer:

Explanation:

Sorry it  is in Java, though you can covert it using converter

public class Exercise {

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int positives = 0;  // Count the number of positive numbers

 int negatives = 0;  // Count the number of negative numbers

 int count = 0;   // Count all numbers

 double total = 0;  // Accumulate a totol

 // Promopt the user to enter an integer or 0 to exit

 System.out.print("Enter an integer, the input ends if it is 0: ");

 int number = input.nextInt();

 if (number == 0) { // Test for sentinel value

  System.out.println("No numbers are entered except 0");

  System.exit(1);

 }

 while (number != 0) {// Test for sentinel value

  if (number > 0)

   positives++; // Increase positives

  else

   negatives++; // Increase negatives

  total += number; // Accumulate total

  count++;    // Increase the count

  number = input.nextInt();

 }

 // Calculate the average

 double average = total / count;

 // Display results

 System.out.println(

  "The number of positive is " + positives +

  "\nThe number of negatives is " + negatives +

  "\nThe total is total " + total +

  "\nThe average is " + average);

}

}

You might be interested in
After stating your thesis, follow up by demonstrating the importance of the topic, and explain why the audience or future audien
bearhunter [10]

Answer: audience relevance

Explanation:

Most importantly when stating a thesis we should show and present how the work in the thesis is relevant to the audience. In this way we would be able to connect our research work more to the people and the audience. We should be able to state how our work is going to benefit them, what the people should do in this regard and all the dos and don't must be mentioned clearly while stating our thesis.

4 0
3 years ago
PLEASE HELP ITS TIMED Ishmael would like to capture a selected portion of his screen and then capture actions he performs on tha
jek_recluse [69]

Answer:

Option B

<u><em>Hope this Helps!!! :)</em></u>

6 0
2 years ago
Some of the latest smartphones claim that a user can work with two apps simultaneously. This would be an example of a unit that
SIZIF [17.4K]

Answer:

MULTITASKING OS

Explanation:

MULTITASKING OPERATING SYSTEM is an operating system that enables and allow user of either a smartphone or computer to make use of more that one applications program at a time.

Example with MULTITASKING OPERATING SYSTEM smartphones user can easily browse the internet with two applications program like chrome and Firefox at a time or simultaneously

Therefore a user working with two apps simultaneously is an example of a unit that uses a MULTITASKING OS.

3 0
2 years ago
Usually, the same software that is used to construct and populate the database, that is, the DBMS, is also used to present ____.
anygoal [31]

Answer: Queries

Explanation: A database management system(DBMS) is a system that contains the data/information in the form of content or tables.There is a software that can populate the system by the excess data usually found in the SQL format

A query is the demand for the extraction of the information that is present in the database table or content.It helps in presenting extracted data in the readable data.The most commonly used language for the queries is the SQL (structured query language) queries.Thus, the correct option is queries.

3 0
2 years ago
Instance variables are declared private to prevent direct modification. Access to the variables is instead provided through meth
yuradex [85]
<span>Instance variables are declared private to prevent direct modification. Access to the variables is instead provided through methods. This practice is known as.. 
</span><span>c. encapsulation.  It </span><span>is a mechanism of bundling the data (variables) and code acting on the data (methods) together as one.</span>
7 0
3 years ago
Other questions:
  • Assume that a kernel is launched with 1000 thread blocks each of which has 512 threads. If a variable is declared as a shared me
    6·1 answer
  • Software (often on firmware) designed to make physical products and devices "smarter" by doing things like sharing usage informa
    12·1 answer
  • Lux Ladies, Inc., is a company that specializes in expensive and unusual gifts for all occasions. It keeps a large file of infor
    11·1 answer
  • In every organization, workers receive and sendinformation daily. The flow of this information should be____________.upward and
    11·1 answer
  • g Q 2 Suppose I need a data structure having the following characteristics: a) must be very space efficient, and b) I have a goo
    6·1 answer
  • What is emerging as a major business area of innovation that offers a flexible collection of computers on the internet that can
    6·1 answer
  • Given an char variable last that has been initialized to a lowercase letter, write a loop that displays all possible combination
    8·1 answer
  • How to print wireless from laptop to samsung printer?
    6·2 answers
  • Mario is giving an informative presentation about methods for analyzing big datasets. He starts with the very basics, like what
    13·1 answer
  • Someone please help ASAP will brainlist
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!