944,146 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1265
  • Java RSS
Nov 8th, 2007
0

Help on a reading from a file programming

Expand Post »
Well I did not have a problem with my last program assignment which involved me making the Student class that I attached below, But in my new assignment i have too Write a program that will use the Student class developed in the previous assignment to provide a menu-based interactive capability. The program will also read/write files. You may have to modify your original Student class.
The main method will create the files and display a menu, read the user's choice from the keyboard, and perform the corresponding action. After each action, the menu is displayed again. This continues until the user chooses "Exit".

Choice 1 will read the next line from the input file, create the student object,
and assign its instance variables.
Choice 2 will prompt the user to create a new student object as in the previous
assignment
Choice 3 will display the student's info in the format given below.
Choice 4 (change info) will display the following submenu:

Change student info
------------------------------------------
1 - change credit hours
2 - change residency (in-state/out-of-state)
3 - change financial aid status and amount
4 - return to main menu

The user is prompted for the new value, and the submenu is redisplayed until
"return to main menu" is selected.

Choices 5 and 6 will display the student's bill on the screen and write it to
the output file, respectively, using the format in the previous assignment.
Output two blank lines after each student bill.

And I don't really know anything about reading from a file or writing out to a file in java and ive done some research on it but none of it is getting through to me, if anyone could help it would be greatly appreciated, I have also attached my p7 file which is the code i have so far on my new assignment and how i have it set up, Thank you to anyone who can help
Attached Files
File Type: java BMR_Student.java (6.1 KB, 31 views)
File Type: java BMRp7.java (2.4 KB, 27 views)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Hyiero is offline Offline
10 posts
since Nov 2007
Nov 8th, 2007
0

Re: Help on a reading from a file programming

Reading from file tutorial
Writing to file tutorial
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004
Nov 8th, 2007
0

Re: Help on a reading from a file programming

yes that helps but also how would i go about changing the student class to use the input from a txt file to fill out the information
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Hyiero is offline Offline
10 posts
since Nov 2007
Nov 8th, 2007
0

Re: Help on a reading from a file programming

This class allows you to read an input file.txt specified when invonking the constructor.
It prints out line by line. You can save each line into an array if you want to. Or you can save each word in the line into an array by invoking the split function.
Last edited by jwenting; Nov 9th, 2007 at 12:44 am. Reason: we're not doing kids' homework for them... And use codetags next time you post some code.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
galanshi is offline Offline
10 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Adding components at runtime ontop of a scrollable table
Next Thread in Java Forum Timeline: while loop





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC