|
Given an array of real values, return the average of the numbers. If the array contains no element, return a default value 0.0. getAverage([2.0, 3.0]) → 2.5 getAverage([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]) → 3.5 getAverage([]) → 0.0 |
Note: As you have not mentioned programming language.Hence , I did it in python.
Code:
def getAverage(a):
avg = 0.0
if len(a) == 0:
return avg
avg = sum(a)/len(a)
return avg
print(getAverage([2.0, 3.0]))
print(getAverage([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]))
print(getAverage([]))
Output:

Given an array of real values, return the average of the numbers. If the array contains...
This is for JAVA programming. Create a test class that contains two arrays and two methods: - The first array has 3 rows and 3 columns and is initialized with type double data - The second array has 4 rows and 4 columns and is also initialized with type double data - The first method ArraysRows will receive an array of type double as an argument and then print out the sum and average of all elements in each ROW....
Q.1 Chloroform (1) and n-heptane (2) forms a 2 phase systems for which the following plot is givern: 6.0 5.5 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 6.0 5.5 5.0 4.5 4.0 3.5 2.5- 2.0- 1.5 1.0 0.5 0.0 0.0 0.2 0.4 0.6 0.8 1.0 (a) Use Van Laar equation to calculate y?, y2 and P for x1-02. Given P1 at-44.51 kPa; P2 at-65.54kPa (b) Do the activity coefficients show positive or negative deviation from activity...
1. [12 pts) Estimate the area of the region between the x-axis and graph of the function /(x) = x2 - 4x + 5 from I=Ito = 4: (a) By using the lower sums , with 6 subintervals of equal length. Include a sketch of the corresponding rectangles used in the estimate, 6.01 0.5 0.0 L 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 (b) By using the upper sums S, with 6 subintervals of...
A variety of spectra for an organic compound with molecular
formula C10H16O are presented below. The
experimental accurate mass using (+) APCI source is 153.1280 u. The
1H, 13C, COSY, HSQC and HMBC NMR spectra are given in the following
slides. Propose a structure for this unknown and answer or address
the following questions or requirements:
d. If there are still any questionable assignments, propose
additional NMR experiments which would solve those questions and
briefly explain specifically what correlations you...
which of the following compunds matches the soectrum given? Circle
the correct answer and explain your reasoning for A, B, C, D.
We did not cover this in lecture and are now encountering it
in lab. Can you please tell me what the correct answers are, but
also the steps to taje to solve the problem on ny own? Thank
you!
2. Which of the following compounds matches the spectrum given? Circle the correct answer and explain your reasoning. ide...
A variety of spectra for an organic compound with molecular
formula C10H16O are presented below. The
experimental accurate mass using (+) APCI source is 153.1280 u. The
1H, 13C, COSY, HSQC and HMBC NMR spectra are given in the following
slides. Propose a structure for this unknown and answer or address
the following questions or requirements:
a. Using the most abundant isotopes of C, H and O, what are the
errors in ppm and milli-Daltons for the experimental accurate
mass?...
Please help me interpret the proton NMR of this
unknown aldehyde.
ZACH RIA A3 2 -1400 -1300 -1200 -1100 1000 -900 -800 -700 -600 -500 400 300 -200 -100 -100 -5.5 4.5 -5.0 -3.5 -4.0 -2.5 -3.0 -1.5 -2.0 -0.5 -1.0 f1 (ppm) 0.5 0.0 1.5 1.0 2,5 2.0 4.0 3.5 3.0 Adtyd SE 910- 660-h ar
ZACH RIA A3 2 -1400 -1300 -1200 -1100 1000 -900 -800 -700 -600 -500 400 300 -200 -100 -100 -5.5 4.5 -5.0 -3.5...
5.0 69 4.5 68 3.5 3.0 $ 2.5 2.0 67 65 64 63 61 1.0 0.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 UNEMPLOYMENT RATE (Percent)
The distribution for a population of measurements is presented in the histogram below. The mean is 3.2 and the standard deviation is 2. Suppose that five students each take a sample of ten values from the population and each student calculates the sample mean for his or her ten data values. The students draw a dotplot of their five sample means on the classroom board so that they can compare them. Which of the dotplots a -c do you think...
In C,
1. For the mechanical system shown in the figure below, given mass 6kg and coefficient of kinetic friction 0.3, the applied force p is expressed as a function of time t (in seconds) by 20 if t 2 0.0 and t s 3.0 p(t)-4(t 2) if t > 3.0 and t s 6.0 4(t2 + 2t) if t > 6.0 Normal Force Motion Applied Force Force of Friction Force of Gravity Calculate the force dependent on the time...