Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Take the FindGrade.java file and modify it so it displays text fields for first

ID: 3831375 • Letter: T

Question

Take the FindGrade.java file and modify it so it displays text fields for first name, last name and age and inserts the person into the database.







//package chapter 32. inpart javafx application Application import javafx.si ene. Scene impart javafx scene, control Button impart javafx, scene.control.Label import javafx scene.control Text Field import javatx.scene,layout. HBox import javafx .VBox; import javafx. stage.Stage import java.sql public class Find6rade extends Application for executing queries private statement stmt private Text Field tffnane new TextField() private Text Field tflastnane E, new Text Field private Label ibistatus new Label 20verride override the start nethod in the Application class public vaid start Stage primaryStage) Initialize database connection and create a statement abject initialize DB Button btshowAge new Button Show Ag Button bt ShowAli new Button Show A11 Button bt Delete new Button ("Delete Person") new HBox(5 hBox get children addAll(new Label ("First Nane"), tffname, btShowAge, btshowAlle btDelete new VBox (10) VBox VBox vBox .get Children addAll(hBox, 1blStatus); ttfnane, set prefcolumnCount (6 btshowAge.setonAction (e show Age() bt ShowAl1.setonAction(e showAli() bt Delete setonAction(e delete someone

Explanation / Answer

Your all code is right, you have to change and add only some of the code in your program:

In the start() I am adding some code

Public void start(Stage primaryStage)

{

//add this for displaying textfield for fname,lname and age

        tffname.setEditable(true);

        tflname.setEditable(true);

        tfage.setEditable(true);

//add insert button on the form to click on this button to insert fields in person table

Button btInsert = new Button(“Insert”);

}

//write insert function

private void insertlpa()

{

try{  

String querystring= “insert into person values(?,?,?)”;

PreparedStatement stmt=con.prepareStatement("querystring);  

stmt.setString(1,”sara”);//1 specifies the first parameter in the query  

stmt.setString(2,"George");

stmt.setInt(3, 20);  

  

int i=stmt.executeUpdate();  

System.out.println(i+" records inserted");  

  

con.close();  

  

}catch(Exception e){ System.out.println(e);}  

  

}  

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote