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]
3 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]3 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
When converting text to a table, which feature should be used?
velikii [3]
I’m pretty sure it would be an insert tab
4 0
2 years ago
What is an example of constructive criticism for an employee who frequently arrives late?
aleksley [76]
I believe the correct answer is A
5 0
3 years ago
Read 2 more answers
One of the earlier applications of crypto-graphic hash functions was the storage of passwords to authenticate usersin computer s
vagabundo [1.1K]

Answer: provided in the explanation part.

Explanation:

This is actually quite long but nevertheless i will make it as basic as possible.

Question (a)  

Attack A:

One way property of hash means that we can't find the input string if given the hash value. The calculation of hash from input string is possible but it is not possible to calculate the input string when given the hash. If the hash function is properly created to have one-way property then there is no way of finding the exact input string. So this attack won't work as the one-way property of hash function can't be broken if the hash function is properly created.

Attack B:

Suppose h() is the hash function. And h(x) = m where x is the string and m is the hash. Then trying to find another string y such that h(y) = m is called finding out the second pre-image of the hash.

Although we can't know the exact initial string for sure, we can by using brute force method find out a second preimage.

This attack will take a very long time. It has the time complexity of 2n. It requires the attacker to have an idea about the kind of passwords that might be used and then brute force all of them to find the string that has the same hash. Each try will have a chance of 1/2n to succeed.

Rainbow attack using rainbow table is often used for such brute-force attack. This comprises a rainbow table which contains passwords and their pre-hashed values.

Therefore, it is not possible to determine the second preimages of h so easily.

Attack C:

Collisions refer to finding out m and m' without knowing any of them. Finding out collisions is easier than finding preimages. This is because after finding out 2n pairs of input/output. The probability of two of them having the same output or hash becomes very high. The disadvantage is that we can't decide which user's hash to break. However, if I do not care about a particular user but want to get as many passwords as possible, then this method is the most feasible.

It has the time complexity of 2n/2.

Hence, this is the attack which has the most success rate in this scenario.

Question (b)

The brute force way of finding out the password usually involves using a rainbow attack. It comprises a rainbow table with millions of passwords and their hashes already computed. By matching that table against the database, the password can be recovered.

Therefore it is often preferred to salt the password. It means we add some random text to the password before calculating the hash.

The salts are usually long strings. Although users usually do not select long passwords, so a rainbow table with hashes of smaller passwords is feasible. But once salt is used, the rainbow table must accommodate for the salt also. This makes it difficult computationally. Although password might be found in the rainbow table. The salt can be anything and thus, make brute-force a LOT more difficult computationally.

Therefore salt is preferred to be added to passwords before computing their hash value.

Question (c)

A hash output length of 80 means there can be exactly 280 different hash values. This means there is at least one collision if 280+1 random strings are hashed because 280 values are used to accommodate all the possible strings. It is not hard with today's computation power to do match against more than this many strings. And doing so increases the probability of exposing a probable password of a user.

Hence, 80 is not a very secure value for the hash length.

cheers i hope this helps!!!!

6 0
3 years ago
Suppose that outFileis an ofstreamvariable and output is to be stored in the file outputData.out. Which of the following stateme
BlackZzzverrR [31]

Answer:

Option b outFile.open("outputData.out");

Explanation:

In C++, there are several classes given to handle output and input of characters to or from files. They are:

  • ofstream that write on files
  • ifstream that read from files

We can use an object of ofstream to hold the contents that we wish to output to an external file. The general syntax is as follows:

           ofstream_obj.open(file_name)

This will create a file with a specific file name and it possesses all the contents from the obstream_obj.

5 0
2 years ago
What are the six primary roles that information system play in organizations? How are information system used in each context
Nina [5.8K]

The primary roles that information system play in organizations are:

  • Decision making
  • Operational management
  • Customer interaction
  • Collaboration on teams
  • Strategic initiatives
  • Individual productivity
<h3>How are information system used in each context</h3>

The six main functions of information systems in an organization are as follows:

1. Operational management entails the creation, maintenance, and enhancement of the systems and procedures utilized by businesses to provide goods and services.

2. Customer relationship management: Maintaining positive and fruitful relationships with customers, clients, students, patients, taxpayers, and anyone who come to the business to purchase goods or services is essential for success. Effective customer relationships contribute to the success of the business.

3. Making decisions: Managers make decisions based on their judgment. Business intelligence is the information management system used to make choices using data from sources other than an organization's information systems.

4. Collaboration and teamwork: These two skills complement the new information systems that allow people to operate from anywhere at a certain moment. Regardless of their position or location, individuals can participate in online meetings and share documents and applications.

5. Developing a competitive edge: A firm can establish a competitive advantage by outperforming its rival company and utilizing information systems in development and implementation.

6. Increasing productivity of objection: Smart phone applications that mix voice calls with online surfing, contact databases, music, email, and games with software for minimizing repetitive tasks are tools that can help people increase productivity.

Learn more about information system from
brainly.com/question/14688347
#SPJ1

4 0
11 months ago
Other questions:
  • Operating system software allows you to use your fingers, a mouse or other pointing device to select screen controls, such as bu
    5·2 answers
  • which virtue you need to secure information by limiting computer access to authorized personnel only?
    10·1 answer
  • How much days are in a year
    9·2 answers
  • A bank uses a computer program during the night to tell if the alarm should ring. Sensors in the bank set the following Boolean
    5·1 answer
  • Suppose there are two links between a source and a destination. The first link has transmission rate 100 Mbps and the second lin
    12·1 answer
  • The___provides access to the internet; may also be internal
    11·1 answer
  • ​Suppose your computer network was compromised in a large scale virus attack last Thursday. Most of the data files got corrupted
    8·1 answer
  • The _______ within a story are the people and/or objects that the story is about
    5·2 answers
  • How to get the lightning round in dares of eternity
    5·1 answer
  • A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!