a ruby program problem
****************************************************************************


compute.rb
# Note I have changed the name of the function "print" to "prints" because I have used
# ruby's print function inside prints function.
class Histogram
@lowScore # lowest possible Score in scores
@hiScore # highest possible score in scores
@bucketSize # size of each bucket
@count # count of each bucket
@Count # number of scores
@Average # average of scores
@StdDev # standard deviation of scores
def initialize(lowScore=0,hiScore=100,bucketSize=10) # initializer function
@lowScore = lowScore
@hiScore = hiScore
@bucketSize = bucketSize
@count = Array.new((hiScore-lowScore)/bucketSize){0}
@Count = 0
end
def addScores(file) # add Score function
total = 0
File.open("scores.txt").each do |score|
addScore(score.to_i) # count of each bucket
@Count += 1 # count of the number of scores
total += score.to_i # sum of scores
end
@Average = total.to_f/@Count # average of score
tmp = 0
File.open("scores.txt").each do |score|
tmp += ((score.to_i-@Average)**2/@Count.to_f)
end
@StdDev = tmp**0.5 # standard deviation of score
end
def addScore(score) # fnction to increament the count of each bucket
i = (score-@lowScore)/@bucketSize
@count[i] += 1
end
def prints # function to print
max = @count.max
puts "Count = %s, Average = %s, StdDev = %s"%[@Count,@Average.round(2),@StdDev.round(2)]
while max>0
for s in @count
if s>=max
print "%3s%1s"%["*"," "]
else
print "%4s"%[" "]
end
end
puts ""
max = max -1
end
i = @lowScore
while i<@hiScore
print "%3s%1s"%[i,"."]
i = i+@bucketSize
end
print @hiScore
end
end
h = Histogram.new
h.addScores("scores.txt")
h.prints



a ruby program problem **************************************************************************** Ruby These short language exercises are intended to help you to...
CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes the user and displays the purpose of the program. It then prompts the user to enter the name of an input file (such as scores.txt). Assume the file contains the scores of the final exams; each score is preceded by a 5 characters student id. Create the input file: copy and paste the following data into a new text file named scores.txt DH232 89...
i have the text file to pull info off of. This is for JAVA. Must use arrays, JOptionPane, methods, and be able to pull and count from the file that is provided to me by my instructor. The file is a txt file that has over 1000 test scores on it without commas. Spaces are used. Please help. Standardized Test Scores A local high school is giving a standardized test to all of its students. There are 50...
What to submit: your answers to exercises 2. Write a Java program to perform the following tasks: The program should ask the user for the name of an input file and the name of an output file. It should then open the input file as a text file (if the input file does not exist it should throw an exception) and read the contents line by line. It should also open the output file as a text file and write...
please use the c language
Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 scores 201 1710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student id...
Implement a Java program using simple console input & output and logical control structures such that the program prompts the user to enter 5 integer scores between 0 to 100 as inputs and does the following tasks For each input score, the program determines whether the corresponding score maps to a pass or a fail. If the input score is greater than or equal to 60, then it should print “Pass”, otherwise, it should print “Fail”. After the 5 integer...
Write a program that will calculate your letter grade at the end of the semester for CSIS130. Your program will read an input file that shall contain all the tests scores and lab scores for the semester, and the input file data should be in the following format: full name of student Test1 Score (0…100), Test2 Score (0..100) , Final Exam Score (0..100), Total Number of Labs: N NLab Scores (0=Fail, 1=Pass) [You will have N lab scores each separated...
Write python code on computer, No handwritten
code
You will implement a program which asks the user to enter scores of different courses in different semesters. The program should read the input and output some simple statistics 1. An example input string by the user is given below. Fal12016-coursel:82, course2:80,course3:85;Spring2018- course4:82;Fall2018-course5:85, course6:50, course7:78 Info from different semesters are separated by a ";", courses in each semester are separated by a,and score and corresponding course is separated by a, information of...
Java programming help My program wont run. could someone tell me why. everything seems correct to me... giving me the error: Exception in thread "main" java.lang.NumberFormatException: For input string: "Stud" at java.base/java.lang.NumberFormatException.forInputString(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at Util.readFile(Util.java:35) at Driver.main(Driver.java:8) _________________________________________________________________________________________________________________________ Program Prompt: Write a program to perform statistical analysis of scores for a class of students.The class may have up to 40 students.There are five quizzes during the term. Each student is identified by a four-digit...
Use your knowledge of algorithm development to create a program using RAPTOR to solve the problem below. Input a list of student names (in to array student[]) and testing scores stored in parallel arrays. Each student have 3 testing scores ranging from 0 to 100 (store into parallel array score1[], score2[], score3[]). Output average score for each student and print out what is his final grade. If average score <60, got F grade. If 60<=average score<70, got D grade. If...
Write a program that uses the keys(), values(), and/or items() dict methods to find statistics about the student grades dictionary. Find the following: Print the name and grade percentage of the student with the highest total of points. Also print the grade as per the below grading scale 90 to 100 A 80 to 89 B 70 to 79 C 60 to 69 D Below 60 F Find the average score of each assignment. Use the following data:...