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
Naily [24]
4 years ago
8

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a

nd 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. Sample Run 1
Computers and Technology
1 answer:
nika2105 [10]4 years ago
3 0

Answer:

import java.util.Scanner;

public class NumbersStats {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int pos = 0, neg = 0, count = 0, num;

       double total = 0;

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

       while (true) {

           num = in.nextInt();

           if(num == 0) break;

           if(num > 0) {

               pos++;

           } else {

               neg++;

           }

           total += num;

           count++;

       }

       System.out.println("The number of positives is " + pos);

       System.out.println("The number of negatives is " + neg);

       System.out.println("The total is " + total);

       System.out.println("The average is " + (total/count));

   }

}

Explanation:

You might be interested in
What is Network Address Translation (NAT) and how does it work in a network?
Allisa [31]

Answer:

 Network address translation (NAT) is a method for designing the IP address and it basically operate on router. NAT usually connect two network together and translate the unique and private address into the legal address.

Network address translation is a technique that works in network  for re-mapping the IP address into another by modify the network address information into the IP packet header. NAT gateway are used for the entire private network.  

The network address translation use both the security and economical purpose in an organization to limit the public IP address.

5 0
3 years ago
Case 1-1Tom has just started working as an intern for a local radio station. He is responsible for managing the request line and
pantera1 [17]

Answer:

The answer is Live Preview.

Explanation:

<em>Live Preview is a Powerpoint tool that helps the user to find out how a singular choice will change the appearance of the presentation, without committing any change. This application allows the user to edit any slide and see the changes without any risk of damaging the rest of the presentation.</em>

<em>It lets the user see how an actual change will look on the slide  object before the user decides to accept or decline the change.</em>

<em>It is a powerful resource, because we know how handful it is to prepare a powerpoint presentation.</em>

3 0
3 years ago
Write three functions in C/C++: one that declares a large array statically, one that declares the same large array on the stack,
Nikolay [14]

Answer:

See explaination

Explanation:

#include<iostream>

#include<stack>

#include <algorithm> // std::make_heap, std::pop_heap, std::push_heap, std::sort_heap

#include <vector> // std::vector

using namespace std;

void StaticArray()

{

unsigned int array[64536];

for(unsigned int i=0;i<64536;i++)

array[i]=i;

}

void Stack()

{

stack<unsigned int> mystack;

for(unsigned int i=0;i<64536;i++)

mystack.push(i);

}

void Heap()

{

unsigned int myints[64536];

for(unsigned int i=0;i<64536;i++)

myints[i]=i;

vector<unsigned int> v(myints,myints+64535);

make_heap (v.begin(),v.end());

push_heap (v.begin(),v.end());

}

int main()

{

StaticArray();

Stack();

Heap();

return 0;

}

7 0
3 years ago
Objects have methods and properties. what are methods and properties?
son4ous [18]

Methods are bits of code, which can be executed. They define the behaviour of the object. Properties are bits of data, contained within the object, they define the state of the object.

3 0
4 years ago
Trying to create a list of valid email addresses by sending email to randomly generated addresses and seeing which ones are deli
Zina [86]
It is called phishing. Phishing is the endeavor to acquire delicate data, for example, usernames, passwords, and Visa points of interest, frequently for vindictive reasons, by camouflaging as a reliable substance in an electronic correspondence. 
Phishing is ordinarily done by email satirizing or texting, and it regularly guides clients to enter individual data at a fake site, the look and feel of which are practically indistinguishable to the true blue one.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Describe the role of a chemist and the role of a chemical engineer
    9·1 answer
  • Question 2Write a MIPS assembly implementation of the following C/C++ code. Assume small, unsigned integer arithmetic (no range
    10·1 answer
  • an IPv6 packet has a 40 byte base header, a 20 byte destination options extension header (which is not used for routing) and 200
    5·1 answer
  • What invention was key to computers being moved into homes and personal use?
    10·2 answers
  • How to change the size of my document in cs6?
    13·1 answer
  • Filmmakers must often establish information quickly in a film in order to give the audience context for the plot. In this film,
    5·1 answer
  • What are the functions of the windows button, Task View and Search Box? give me short answer
    15·1 answer
  • . Write at least three benefits of using a network.​
    8·1 answer
  • Difference between tell() and seek().​
    11·1 answer
  • You would like the word "Employee" to appear in cells A1, B1, C1, D1, and E1. To be efficient, you should
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!