Assignment practices java classes in the java.io package that process text and binary files.
Please note:
The BufferReader class's readLine method returns a line from a file as a String. If you need to perform calculations, you will need to convert the String object into a number. You can use a wrapper class to convert.
These methods are:
Methods Purpose Example
Integer.parseInt Convert a String to an int int num=Integer.parseInt(str)
Double.parseDouble Convert a String to a double double num=Double.parseInt(str)
Byte.parseByte Convert a String to a byte byte num=Byte.parseByte(str)
Float.parseFloat Convert a String to a float float num=Float.parseFloat(str)
Long.parseLong Convert a String to a long long num=Long.parseLong(str)
Short.parseShort Convert aString to a short short num = Short.parseShort(str)
Write a Java application to accomplish the following task:
- Ask users to input the amount of tax they paid for the past 3 years.
- Write this information to a text file.