Results 1 to 2 of 2
- 11-20-2012, 05:08 AM #1Member
- Join Date
- Sep 2012
- Rep Power
How do i import a .dat file into java and isolate the numbers that are in the file?
Hey guys just got this class assignment, here it is.... "Program 213a
Program Description: You just started working as a programmer. You are paid $10 an hour, with a few exceptions. You earn an extra $1.50 an hour for any part of a day where you work more than 8 hours, and an extra $2.50 an hour for hours beyond 40 in any one week. You also earn a 125% bonus for working on Saturday, and a 50% bonus for working on Sunday. The bonuses for Saturday and Sunday are computed based on the hours worked those days; they are not used to calculate any bonus for working more than 40 hours in a week.
Your input file will be the number of hours you worked each day in the week beginning with Sunday. You need to write a program that will continue processing the file to calculate your gross pay for each week worked until the end of file is reached. Each line of input will consist of one weeks hours (7 integers per line, each less than or equal to 24). Ouput the gross pay with a dollar sign rounded to the nearest penny for each week worked.
Statements Required: loops, decision making
Data Location: prog213a.dat
Hours Worked: 9 8 10 8 9 9 5
Week # 1 $703.50
Hours Worked: 7 8 8 8 0 8 9
Week # 2 $627.50
Hours Worked: 6 10 5 0 0 0 0
Week # 3 $243.00
Hours Worked: End of reading from file."
Can some one tell me how to import files in java. Or how to isolate the numbers in the file? Either one to get me started, please and thank you.
- 11-20-2012, 05:41 AM #2Member
- Join Date
- Nov 2012
- Rep Power
Re: How do i import a .dat file into java and isolate the numbers that are in the fil
Well *.dat files are usually just a generic term for any number of formats... so what exactly is in the file? If it is plain text then you can just fire up the FileIO and start looking for patterns to parse on.
Last edited by Jingoism; 11-20-2012 at 05:50 AM.
- By Niisha in forum Advanced JavaReplies: 0Last Post: 03-25-2012, 06:31 PM
- By hqt in forum EclipseReplies: 1Last Post: 02-08-2012, 11:58 AM
- By black300 in forum JDBCReplies: 0Last Post: 04-02-2011, 11:22 AM
- By jkrishnanvenkat in forum New To JavaReplies: 3Last Post: 11-09-2009, 03:46 AM
- By vijayinani in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 06-30-2009, 11:05 PM