Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Restrictions: You cannot import any Java classes except those listed below. In particular, you cannot use any methods from the Java Array(s) class to copy

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Restrictions: You cannot import any Java classes except those listed below. In particular, you cannot use any methods from the Java Array(s) class to copy an array, check for equality, or otherwise manipulate an array. You also may not call the Java System.arraycopy method. You must write the Java code to perform these functions. You will need to use (import): - the Java File class. You may use any of the methods that are available in the Java File class in developing your algorithm. In particular, you should need to use the: o java.io.File - java.io.FileNotFoundException - the Java Scanner class - the Java wrapper classes if needed. - any of the classes that you created in any previous assignment in this course. Specifically, if needed, you can use your ArrayBag, LinkedBag or SinglyLinkedList (from textbook Code Fragments) classes if needed. - any Java exception class. - The java.io classes needed to write to a text file: o java.io.FileOutputStream - java.io.PrintWriter Be sure to read the entire assignment before you begin. Create a NetBeans project using the convention Lab106-LastFM and ensure it is saved to a location like desktop or your flash drive. In the project you will do the following: The Problem: An inventory of paper and electronic U.S. Savings bonds needs to be maintained. The U.S. Treasury provides a webpage for maintaining an inventory of Paper Savings Bonds at: Calculate the Value of Your Paper Savings Bond(s) (treasurydirect.gov) While this webpage is titled for paper savings bonds it also works for electronic savings bonds. Once you enter your bonds in on the Treasury webpage you need to use the Mozilla Firefox web browser to save the inventory. Microsoft Edge and Google Chrome browsers are not compatible. After saving the webpage it can be reloaded in a browser to add more bonds and/or update the values. The upsides of the Treasury webpage are: - It shows the current value of each bond. - It shows the current interested rate for each bond. The downsides of the Treasury webpage are: - It does not calculate the actual return on each bond. - It does not allow for a user defined memo/description field for each bond. An Excel spreadsheet is currently being used maintain an inventory of the bonds. The upsides of the Excel spreadsheet are: - It calculates the actual return for each bond. - It has a memo/description field for each bond. The downsides of the Excel spreadsheet are: - The current value of each bond must be manually entered each month. The Task: Your task will be to write a Java program that does the following: - Convert the Excel spreadsheet information into an HTML file that the Treasury website can read and understand. - You will actually be converting a comma separated value (CSV) file that is generated by Excel into an HTML file that the Treasury website can read and understand. - For this assignment you are only going to go "one way": - You are going to covert a CSV file into an HTML file. - You ARE NOT required to convert the HTML file into a CSV file. It will not be necessary for you to create a web page. You will just need to modify and existing web page so that it includes the information about the bonds in the inventory, i.e. you will add the contents of the CSV file to the HTML file. Three examples of the Treasury webpage are included with this assignment: - SavingsBonds-0-Bonds-Entered.html o The default web page with no bond information - SavingsBonds-2-Bonds-Entered.html - The web page with information for two bonds entered. - SavingsBonds-4-Bonds-Entered.html - The web page with information for four bonds entered. Open these files with a browser to see what the Treasury web page looks like. Once loaded you will need to press the Update button to see the fully formatted web page. Fortunately, you do not need to know HTML to complete this assignment. - Open the example files with a text editor such as Notepad to look that the HTML code. - Find the "Hidden Variables" section in the HTML code. - Determine how bond information is stored in the "Hidden Variables" section by comparing the three example web pages. - Open each of the example web pages using a browser to see what the web pages look like. You will need to press the UPDATE button to see the processed web page. You will need to load the CSV file information into the web page by modifying the "Hidden Variables." Here are some example lines from the CSV file: 1/23/2008,200,R000000010l,Memo101/4/2022,100,IAAF1,Memo1111/3/2022,5000,V0000000012I,Memo1211/25/2022,100,IAAGM,Memo13 - The first field is the purchase date in MM/DD/MYYY format. - The second field is the denomination of the bond: - The issue price for series I bonds is the same as the denomination. - The issue price for series EE bonds is the half the denomination. - The third field is the serial number: - For paper bonds serial numbers look like V000000012l where: - The leading letter indicates the denomination of the bond. - The trailing letter(s) indicates the series of the bond. - You only need to support series E, EE, and I. For electronic bonds serial numbers look like IAAF1 where: - the first letter indicates the bond series. - The fourth field is a memo field that can be ignored. Note that there are a number of "Hidden Variables" that are not included in the CSV file. Your code can just enter values of zero or blank for those fields. HINT: - In your text editor try adding a new bond to one of the example HTML files by adding additional values to the Hidden Variables. - Then save the HTML file and open the HTML in a browser. - Press the UPDATE button to see your updated inventory. - If you get an error, then you did not correctly add the additional values to the Hidden Variables. - Repeat this process until you determine how to correctly add a new bond. Now write the Java code that generates an HTML file that includes the bond information for each bond in the CSV file. - The input for your program is the CSV file. - The output for your program is the HTML file. To complete this assignment, you will need to be able to read from and write to text files. This information was covered in CSCI 160 in Chapter 11 of Java Illuminated. A PDF copy of this chapter has been included with this assignment. Sections 11.3, 11.4 and 11.5 cover reading/writing from/to text files

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

l List elements to consider when developing an employee handbook.

Answered: 1 week ago