Question
Asked by:
mgfloyd71
mgfloyd71
Rating : No Rating
Questions Asked: 2
Tutorials Posted: 0
 

$10.00 Develop an application that reads product id, product name and product price from an input text file.

Q:
Develop an application that reads product id, product name and product price from an input text file.

Example input product text file should be in the format:

1001 Rake 20.00
1002 Hose 15.00
1003 Lawnmower 200.00
1004 Drill 150.00

Product id should be the first field, one word product description should be the second field, and the price in dollars and cents (no commas) should be the third field. White spaces (no commas) should be used as the delimiter between each field and a platform independent line separator should be used at the end of each product record. Your file may be used as input to a future application which is why the format is important.

If the price of the item is greater than or equal to 50.00 write the product information to a text file called WishList.txt. If the price of the item is less than 50.00 write the product information to a text file called GiftIdeas.txt.

If your output file(s) already exist, you should append to the file and not overwrite it. Your output text files should be in the same format as the input product text file. Product id should be the first field, one word product description should be the second field, and the price in dollars and cents (no commas) should be the third field. White spaces (no commas) should be used as the delimiter between each field and a platform independent line separator should be used at the end of each product record. Your output files may be used as input to a future application which is why the format is important.

 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
OO7
OO7
Rating (40): B-
Questions Asked: 1
Tutorials Posted: 131, earned $614.41
 

$10.00 A complete java application to read product id, product name and product price from an input text file

  • This tutorial hasn't been purchased yet.
  • Posted on Jul. 15, 2009 at 01:45:10AM
A:
Preview: ... ease ...

The full tutorial is about 5 words long plus attachments.

Attachments:
Inventory1.zip (1K)
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$10.00 Java, read txt file w/Scanner, sort, write w/ PrintWriter, appending, NetBeans folder, UseNotes, ScreenShot

  • This tutorial was purchased 6 times and rated A+ by students like you.
  • Posted on Jul 15, 2009 at 11:56:09PM
A:
Preview: ... String productName = new String(part[1]);<br><br> // price is the third element of the line:<br> double price = Double.parseDouble(part[2]);<br><br> // sort into big or little output files:<br> if (price >= 50) {<br> System.out.println(" ---> " + bigOutFileName);<br> bigOutStream.println(line);<br><br> } else {<br> System.out.println(" ---> " + smallOutFileName);<br> smallOutStream.println(line);<br> }<br> } catch (Exception e) {<br> // this happens if one of the fields is in the wrong format:<br> System.out.println(<br> "\\\\nmain(): Error in converting input,\\\\n" +<br> e.toString());<br> System.out.println(<br> "Program will terminate.\\\\n");<br> break; // breaks out of while() loop<br> }<br> }<br ...

The full tutorial is about 1897 words long plus attachments.

Attachments:
ProductSort.java (5K) (Preview)
ProductSortUseNotes.txt (5K) (Preview)
ProductSortScreenShot.JPG (49K) (Preview)
ProductSortZipped.zip (61K)
Posted by:
 

$8.00 Product Information in Java - Tested in Netbeans

  • This tutorial hasn't been purchased yet.
  • Posted on Jul 18, 2009 at 01:44:15PM
A:
Preview: ... s application as you requ ...

The full tutorial is about 24 words long plus attachments.

Attachments:
Products.zip (2K)
Posted by:
tayunyang
tayunyang
Rating (5): A-
Questions Asked: 0
Tutorials Posted: 60, earned $93.92
 

$10.00 java app tp read product

  • This tutorial hasn't been purchased yet.
  • Posted on Jul 19, 2009 at 3:03:55PM
A:
Preview: ... I/O, meaning that it uses an internal stor ...

The full tutorial is about 34 words long plus attachments.

Attachments:
javaFileApp.zip (16K)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty