• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

student record program

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello, I'm supposedto write a program that checks to see if the file exists and displays the file contents. Additionally, three statistics need to be computed and displayed. The program needs to count the number of records, compute the meanAge and the meanGPA for each student.

Both meanAge and meanGPA need to be displayed rounded off to three digits beyond the decimal point.
Thisis what I have so far, and I'm wondering if I'm on the right track. I'm a little bit confused on how I can acess every other three lines and then either convert them to a double or int. When I run this program, it gives me a compile error. Any help will be greatly appreciated!
 
avelin chen
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind, I have got it converted to ints and doubles


Also, I have a question, if I want to count the number of time that it diplays name, I know that I can use a for loop.


What would be my upperbound though?
Thanks in advance!
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you don't know an upperbound, this might indicate that you CAN'T use a for loop (at least not how they are meant to be used). Instead you might want to find a way to do it with a while loop instead.

Layne
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic