Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

we need a script and output asking individuals how many magnets they used,how hi

ID: 3679294 • Letter: W

Question

we need a script and output asking individuals how many magnets they used,how high they expect the magnets to be(in inches), what the actual height of the highest magnet is(in inches), which magnet is stronger(the larger or the smaller), and if they enjoyed learning about magnets. then we need to create a histogram comparing the height guesses (in inches) to the actual heights (in inches), we need a bar graph of how many magnets used(such as three people used 4 and five people used six(with a max of seven magnets possible)), and we need a bar graph comparing the people who thought the smaller magnets were stronger to the people who thought the larger magnets were stronger. And the graphs need to be labeled respectfully.

Explanation / Answer

You did not mention, which scripting language you wanted. I have written it in Python.

import matplotlib.pyplot as plt

import numpy as np

n = input('Enter the number of individuals: ');

mag_used = []

exp_mag_heights = []

act_highest_mag = []

stronger_mag = []

enjoy_mag = []

print "Please answer the following questions: "

for i in range(n):

     print "Individual ", i+1, ": "

     mag_used.append(input('How many magnets did you use:(max 7) '))

     exp_mag_heights.append(input('How high do you expect the magnets to be: '))

     act_highest_mag.append(input('What is the actual height of highest magnet: '))

     stronger_mag.append(input('which magnet is stronger(1 for larger and 0 for smaller): '))

     enjoy_mag.append(input('Did you enjoy learning about magnets?(1 for yes and 0 for no) : '))

     print

ind_number = np.arange(n)

width = 0.45

plt.figure()

plt.bar(ind_number, exp_mag_heights, width, color='blue', label='Expected', align='center')

plt.bar(ind_number+width, act_highest_mag, width, color='red', label='Actual')

plt.xticks(ind_number)

plt.title("Comparison of Guessed and Actual Heights")

plt.xlabel("Individual No.")

plt.ylabel("Height")

plt.legend()

plt.show()

plt.figure()

plt.hist(mag_used)

plt.xlabel('No. of Individuals')

plt.ylabel('No. of Magnets used')

plt.show()

plt.figure()

plt.hist(stronger_mag)

plt.xlabel('No. of Individuals')

plt.ylabel('Stronger - Larger or Smaller')

plt.show()