Question: I have the code for this listed below but i have a few errors can i get help clearing up my errors in Java Write

I have the code for this listed below but i have a few errors can i get help clearing up my errors in Java

Write a program to monitor the flow of an item into an out of a warehouse. The warehouse has numerous deliveries and shipments for this item (a widget) during the time period covered. A shipment out (an order) is billed at a profit of 50% over the cost of the widget. Unfortunately each incoming shipment may have a different cost associated with it. The accountants of the firm have instituted a last-in, first out system for filling orders. This means that the newest widget are the first ones sent out to satisfy an order. This method of inventory can be represented by a stack. The Push procedure will insert an incoming shipment while a Pop should be called for a shipment out. Each data record in the text file warehouse.txt will consist of one shipment per line with fields (separated by white space of) I or O (char) shipment coming IN or shipment going OUT # (integer) quantity of the shipment Cost (float) cost per widget of the shipment (Incoming only) Vendor (String) name of the company sending or receiving the shipment Write the necessary procedures to store the shipments received and to process the orders. The output for an order consists of the quantity and the total costs of the widget in the order. Each widget price is 50% higher than its cost. The widgets used to fill an order may come from multiple shipments with different costs. If there are not sufficient widgets in inventory, use all the remaining and bill accordingly. When the simulation terminates display the total amount owed to each of the suppliers (incoming), the number of widgets on hand and the total profit. (in java)

UserConnector.java

package userCreation; import java.sql.*; public class UserConnector { private String firstname; private String lastname; private String username; private String password; private String permissions; public boolean Server_Error = false; public void setUserCreationData(String first, String last, String user, String pass){ firstname = first; lastname = last; username = user; password = pass; } public void UserLogData(String user, String pass){ username = user; password = pass; } public void setPermissions(String userPerm){ permissions = userPerm; } public String getPermissions(){ return permissions; } public String getUsername(){ return username; } public boolean UserCheckConnector() { boolean pass = false; Server_Error = false; try { Connection con = DriverManager.getConnection("jdk:mysql://localhost:3306/users", "UserCreator", "password"); Statement myStat = con.createStatement(); ResultSet rs = myStmt.executeQuery("SELECT * FROM app_users WHERE BINARY UserName= '" + username + "';"); while(rs.next()){ if(rs.getString("Username") !=null){ pass = true; } } rs.close(); myStmt.close(); con.close(); } catch (SQLException exc){ System.out.println(exc); Server_Error = true; pass = true; } return pass; } public void UserCreationConnector() { Server_Error = false; try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/users", "Usercreation", "password"); Statement myStmt = con.createStatement(); myStmt.executeUpdate("INSERT INFO app_users (Username, FirstName, LastName, Pass) VALUES ('" + username + "', " + firstname + "' , '" + lastname + "',MD5('" + password + "'));"); myStmt.close(); con.close(); } catch (SQLException exc) { System.out.println(exc); } } public boolean LoginConnector(){ boolean pass = false; Server_Error = false; try{ Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/user", "app_control", "password"); Statement myStmt = con.createStatement(); ResultSet rs = myStmt.executeQuery("SELECT * FROM app_users WHERE BINARY Username= '" + username + "' AND Pass=MD5('"+password+"'"); while ((rs.next())){ if(rs.getString(("Permissions") !=null){ pass=true; setPermissions(rs.getString("Permissions")); } } if(pass){ myStmt.executeUpdate("UPDATE app_users SET LastLogin=NOW() WHERE BINARY UserName= '" +username +"' AND PASS = MD5('"+password+"'"); } con.close(); myStmt.close(); rs.close(); } catch (SQLException exc){ System.out.println(exc); Server_Error = true; } return pass; } } 

Controller.java

package userCreation; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.event.ActionEvent; import javafx.fxml.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.text.Text; import javafx.stage.*; public class Controller implements Initializable{ @FXML private PasswordField Password_text; @FXML private PasswordField Confirm_text; @FXML private TextField FirstName_text; @FXML private TextField LastName_text; @FXML private TextField Username_text; public Text UsedUsername_text; public Text ServerError_text; public Text NoMatchPass_text; public Text PatternError_text; public Text SubmitError_text; UserConnector userConnector = new UserConnector(); @FXML private void handleBacktoLog_ButtonAction(ActionEvent event) throws IOException{ System.out.println("Switch to login UI"); Parent newuser_ui = FXMLLoader.load(getClass().getResource("/inv_manager/LoginUIDocument.fxml")); Scene newuser_scene = new Scene(newuser_ui); Stage app_stage = (Stage) ((Node)event.getSource()).getScene().getWindow(); app_stage.setScene(newuser_scene); app_stage.show(); } @FXML private void handleSubmit_ButtonAction(ActionEvent event) throws IOException{ resetErrorMessage(); if(accoutFormCheck()){ if(Password_text.getText().equals(Confirm_text.getText())){ System.out.println("The Password match"); userConnector.setUserCreationData((FirstName_text.getText().substring(0,1).toUpperCase() + FirstName_text.getText().substring(1)) (LastName_text.getText().substring(0,1).toUpperCase() + LastName_text.getText().substring(1)) (UsedUsername_text.getText(), Password_text.getText()) if(!userConnector.UserCheckConnector() || !userConnector.Server_Error){ System.out.println("No matching username was found"); System.out.println("Creating new user now"); userConnector.UserCreationConnector(); }else{ if(userConnector.Server_Error){ ServerError_text.setVisible(true); }else{ System.out.println("A matching username was found"); Username_text.setVisible(true); } } }else { System.out.println("Passwords didn't match"); NoMatchPass_text.setVisible(true); } } else{ System.out.println("Pattern Error"); } } private boolean accoutFormCheck() { boolean pass = true; Pattern userpattern = Pattern.compile("^[a-zA-Z]{1}([a-zA-z0-9.]){4,11}$"); Pattern namepattern = Pattern.compile("^[a-zA-Z]{2,16}$"); Pattern passwordPattern = Pattern.compile("^(?=.*[0-9])(?=.*[a-z)(?=.*[A-Z])(?=.*[!@#$%^&+=])(?=\\S+$).{8,16}$"); Matcher matcher = namepattern.matcher((FirstName_text.getText())); if (!matcher.matches()) { pass = false; System.out.println("Firstname field was blank or didn't match a name pattern"); FirstName_text.setStyle("-fx-text-box-border: red; -fx-focus-color: red"); } else { FirstName_text.setStyle(null); } matcher = namepattern.matcher(LastName_text.getText()); if (!matcher.matches()) { pass = false; System.out.println("Lastname filed was blank or didn't match a name pattern"); LastName_text.setStyle("-fx-text-box-border: red; -fx-focus-color: red;"); } else { LastName_text.setStyle(null); } matcher = userpattern.matcher((Username_text.getText())); if (!matcher.matches()) { pass = false; Username_text.setStyle("-fx-text-box-border: red; -fx-focus-color: red;"); System.out.println("Username field was blank or didn't match a username pattern"); } else { Username_text.setStyle(null); } matcher = passwordPattern.matcher((Password_text.getText())); if (!matcher.matches()) { pass = false; Password_text.setStyle(" -fx-text-box-border: red; -fx-focus-color: red;"); Confirm_text.setStyle("-fx-text-box-border: red; -fx-focus-color: red;"); System.out.println("Password field was blank or didn't match a password pattern"); PatternError_text.setVisible(true); } else { Password_text.setStyle(null); Confirm_text.setStyle(null); } if (!pass) SubmitError_text.setVisible(true); else SubmitError_text.setVisible(false); return pass; } private void resetErrorMessage() { ServerError_text.setVisible(false); NoMatchPass_text.setVisible(false); Username_text.setVisible(false); PatternError_text.setVisible(false); SubmitError_text.setVisible(false); } @Override public void initialize(URL url, ResourceBundle resourceBundle) { } } 

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!