Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Getting the average and standard deviation from user input - array

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have to write a program where it takes the grade a user enters from a message box and keeps continuing to ask until the user clicks cancel or OK when the text field is blank.

This is a link to the assignment if it helps http://homepages.uc.edu/~thomam/OOProg_1/assignment5.html

when the user inputs a grade the program takes that number and puts it into an array. Then it finds the average and standard deviation of all the numbers the user enters BUT it refreshes each time the user enters a new number. So each time the user enters a number the text fields refresh. I actually just finished a program similar to this but without the array. I understand how arrays work but I just don't understand how I can take that number the user enters and use it. I know that sounded confusing but I don't understand what that variable is called so I can put it into my equations. I have getters for the average and standard deviation but thats alll I pretty much have so far. This is my code so far, any tips/help?




I have a basic understanding on where everything goes but I have no idea how to use the getters I made. I just guessed because the last time I used one I just did recordPurchase(purchase); but I think this is different. I also have no idea how I can make another catch block to catch is the user enters more than 25 grades. I know this is asking a lot but I could really appreciate the help. I've been stuck on this program all day. I've searched for programs like this all over the internet but I can't find a single one that has helped me out. CAn any of you guys help me?

Thanks

 
author & internet detective
Posts: 40213
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at this line:



What that would do it look for a variable named getAverage. You don't have one of those.



This would look for a method named getAverage() with no parameters. Still not what you want, but getting closer.



This would look for a method named getAverage() with one parameter of a type matching d. Can you figure out what variable you should use instead of "d"?
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic