Results 1 to 2 of 2
- 11-20-2012, 04:08 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 68
- Rep Power
- 0
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
(weird wages)
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
Sample Output:
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, 04:41 AM #2
Member
- Join Date
- Nov 2012
- Posts
- 14
- Rep Power
- 0
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.
http://docs.oracle.com/javase/tutorial/essential/io/Last edited by Jingoism; 11-20-2012 at 04:50 AM.
Similar Threads
-
To import CSV file into java for Plotting graph.
By Niisha in forum Advanced JavaReplies: 0Last Post: 03-25-2012, 05:31 PM -
Import a folder of *java file
By hqt in forum EclipseReplies: 1Last Post: 02-08-2012, 10:58 AM -
import Excel file into Mysql DB via Java unknown problem
By black300 in forum JDBCReplies: 0Last Post: 04-02-2011, 10:22 AM -
how to import xfdf file into the pdf file
By jkrishnanvenkat in forum New To JavaReplies: 3Last Post: 11-09-2009, 02:46 AM -
how to import a ejb bean in java file
By vijayinani in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 06-30-2009, 10:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks