4. a. Will the average of a list of negative numbers always be negative? Explain.bers always...
Write a program that calculates the average of a stream of non-negative numbers. The user can enter as many non-negative numbers as they want, and they will indicate that they are finished by entering a negative number. For this program, zero counts as a number that goes into the average. Of course, the negative number should not be part of the average (and, for this program, the average of 0 numbers is 0). You must use a method to read...
Absolute value is always... 1. Positive 2. Non-negative Every fraction is a rational number. True or False? The sum of 2/3 and 5/7 is 7/10. True or False? The quotient of two fractions cannot be a whole number True or False? The set of whole numbers is a subset of the set of rational numbers. True or False? Which of these fractions is between 7/13 and 14/19 ? 1. a. 6/17 2. b. 9/16 3. c. 1/2 4. d. None...
Write a MARIE program to calculate some basic statistics on a list of positive numbers. The program will ask users to input the numbers one by one. Assume that all numbers will be in the range 1 to 1000. To terminate the data entry, user will input any negative number. Once the data entry is complete, the program will show four statistics about the list of numbers: (1) Count (2) Minimum value (3) Sum of numbers (4) "Mean/Average" calculation. As...
Only used main method please. (Count positive and negative numbers and compute the average, of numbers) Write a program that reads an unspecified number of integers , 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. Display the total as a floating-point number. Display the lowest number in the list. Display the...
Positive and negative: Return these four results using C++ reference parameter Write a function, named sums(), that has two input parameters; an array of floats; and an integer, n, which is the number of values stored in the array. Compute the sum of the positive values in the array and the sum of the negative values. Also count the number of positives and negative numbers in each category. Write a main program that reads no more than 10 real numbers...
3. Let {x1, x2,...,xn} be a list of numbers and let ¯ x denote the average of the list. Let a and b be two constants, and for each i such that 1 ≤ i ≤ n, let yi = axi + b. Consider the new list {y1,y2,...,yn}, and let the average of this list be ¯ y. Prove a formula for ¯ y in terms of a, b, and ¯ x. 4. Let n be a positive integer. Consider...
For C++ Write a main program that inputs a list of 20 numbers from a text file and then calls 4 sort functions. Create a Sort Lab design document that include flowcharts of the main program and four sort functions Sort Functions: Insertion, Selection, Bubble and Merge In each Sort function: count the number of compares and swaps needed to sort the numbers and display that information in the sort function. Run the program for four sets of data --...
Average and Standard Deviation of 4 numbers
**c++**
Write an input function to input 4 doubles. then write a function
that computes the average of 4 doubles and returns the average and
the standard deviation. Write a output routine that shows the 6
numbers. Please feel free to use sub-functions to break up your
code.
you can name the four variables a1, a2, a3, a4, or something
equally simple as long as you are consistent.
Average (or mean) is...
import java.util.*; /** Description: This program determines the average of a list of (nonnegative) exam scores. Repeats for more exams until the user says to stop. Input: Numbers, sum, answer Output: Displays program description Displays instruction for user Displays average Algorithm: 1. START 2. Declare variables sum, numberOf Students, nextNumber, answer 3. Display welcome message and program description 4. DOWHILE user wants to continue 5. Display instructions on how to use the program 6. Inititalize sum and number of student...
Assume the variable LIST is defined as a list of numbers. Write a code segment that utilizes a loop to total up all of the numbers in the list up to, but not including, the first negative number. Store the result in the variable TOTAL. % test cases % LIST = [ 1 4 6 -2 7 9]; TOTAL = 11; % LIST = [ -2 4 5 7 9]; TOTAL = 0; % your code segment here %----------------------- %...