Question: Lab05a Coding here: import javafx.application.Application; import javafx.event.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.control.Alert.*; import javafx.scene.text.*; import javafx.scene.layout.*; import javafx.stage.*; import javafx.geometry.*; /** * Lab05 -

 Lab05a Coding here: import javafx.application.Application; import javafx.event.*; import javafx.scene.*; import javafx.scene.control.*;

import javafx.scene.control.Alert.*; import javafx.scene.text.*; import javafx.scene.layout.*; import javafx.stage.*; import javafx.geometry.*; /** *Lab05 - Threads and Binary IO * @author * @version */ publicclass Lab05a extends Application implements EventHandler { // Window attributes Stage stage;Scene scene; // GUI components private TextField tfCities = new TextField(); private

Lab05a Coding here:

import javafx.application.Application; import javafx.event.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.control.Alert.*; import javafx.scene.text.*; import javafx.scene.layout.*; import javafx.stage.*; import javafx.geometry.*; /** * Lab05 - Threads and Binary IO * @author * @version */ public class Lab05a extends Application implements EventHandler { // Window attributes Stage stage; Scene scene; // GUI components private TextField tfCities = new TextField(); private TextField tfRecords = new TextField(); private TextField tfObjSize = new TextField(); private TextArea taCompleted = new TextArea(); private TextArea taFound = new TextArea(); private Button btnFind = new Button("Find"); /** main program */ public static void main(String[] args) { launch(args); } /** constructor */ public void start(Stage _stage) { // setup window stage = _stage; stage.setTitle("Data Accumulator"); VBox root = new VBox(8); // Textfields in the Top FlowPane fpTop = new FlowPane(8,8); fpTop.setAlignment(Pos.CENTER); fpTop.getChildren().addAll(new Label("Cities: "), tfCities, new Label("Records: "), tfRecords, new Label("Object Size: "), tfObjSize); tfCities.setEditable(false); tfRecords.setEditable(false); tfObjSize.setEditable(false); root.getChildren().add(fpTop); // Two text areas in the Center FlowPane fpCenter = new FlowPane(8,8); fpCenter.setAlignment(Pos.CENTER); fpCenter.getChildren().addAll(taCompleted, taFound); // Use monospaced font Font newFont = Font.font("MONOSPACED"); taCompleted.setFont(newFont); taFound.setFont(newFont); taCompleted.setPrefHeight(250); taCompleted.setPrefWidth(400); taFound.setPrefHeight(250); taFound.setPrefWidth(400); root.getChildren().add(fpCenter); // Find button in the Bottom FlowPane fpBot = new FlowPane(8,8); fpBot.setAlignment(Pos.CENTER); fpBot.getChildren().add(btnFind); btnFind.setDisable(true); root.getChildren().add(fpBot); scene = new Scene(root, 900, 325); stage.setScene(scene); stage.show(); } /** Button handler */ public void handle(ActionEvent ae) { } }

Lab 5 - Threads & Byte lVO and Designing code Sample files of city, state, zip code and other information were broken down into several smaller files for emailing. These are stored in several sequentially numbered binary files in today's downloads. Your job is to write a program that reads as many files as exist. As you read each record, load only the city names into an ArrayList and write some, but not all, of the fields in each record to another file. Then, write the entire ArrayList, as an object, to a third file. Input and output file details are given below You are writing this program to show the feasibility of the processing above, which will be done on a much larger scale with world wide city, state and postal codes. For speed, you are to create one thread per file being read. For example: the filenames are in the format Lab5FileN.dat, where N starts with 1. For the first file you create a thread object that reads in Lab5File1.dat. For the second file a thread is created to process Lab5File2.dat, and so on until your program discovers that the next file does not exist. The threads create the ArrayList as they go, as well as the output file of zip codes, city names, and states (ZipCityState.dat). When all the threads are done, you will report (in a GUI) how many cities were stored in the ArrayList, and how many records were written to ZipCityState.dat Neither input nor output files contain any heading information, only the data shown They are all in binary Each input file (Lab5FileN.dat) has this binary data layoutas follows Field contains Zi Ci State Longitude Latitudes Time Zone DST Daylight savings Integer time observed Data Tvpe Integer UTF UTF Double Double Integer The output binary file ZipCityState.dat is to contain only these three fields. The other information in the input files is ignored and not use Lab 5 - Threads & Byte lVO and Designing code Sample files of city, state, zip code and other information were broken down into several smaller files for emailing. These are stored in several sequentially numbered binary files in today's downloads. Your job is to write a program that reads as many files as exist. As you read each record, load only the city names into an ArrayList and write some, but not all, of the fields in each record to another file. Then, write the entire ArrayList, as an object, to a third file. Input and output file details are given below You are writing this program to show the feasibility of the processing above, which will be done on a much larger scale with world wide city, state and postal codes. For speed, you are to create one thread per file being read. For example: the filenames are in the format Lab5FileN.dat, where N starts with 1. For the first file you create a thread object that reads in Lab5File1.dat. For the second file a thread is created to process Lab5File2.dat, and so on until your program discovers that the next file does not exist. The threads create the ArrayList as they go, as well as the output file of zip codes, city names, and states (ZipCityState.dat). When all the threads are done, you will report (in a GUI) how many cities were stored in the ArrayList, and how many records were written to ZipCityState.dat Neither input nor output files contain any heading information, only the data shown They are all in binary Each input file (Lab5FileN.dat) has this binary data layoutas follows Field contains Zi Ci State Longitude Latitudes Time Zone DST Daylight savings Integer time observed Data Tvpe Integer UTF UTF Double Double Integer The output binary file ZipCityState.dat is to contain only these three fields. The other information in the input files is ignored and not use

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!