include graphics for java program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Please help include graphics for java program below import java.util.Scanner;
import java.sql.*; class Student {     String studName;
    int studNum;
    String coursesTaken;
    float midtermMarks;
    float finalTermMarks;
    String teachComments;
    float finalAvgWthCreEar;     public String getStudName() {
        return studName;
    }     public int getStudNum() {
        return studNum;
    }     public String getCoursesTaken() {
        return coursesTaken;
    }     public float getMidtermMarks() {
        return midtermMarks;
    }     public float getFinalTermMarks() {
        return finalTermMarks;
    }     public String getTeachComments() {
        return teachComments;
    }     public float getFinalAvgWthCreEar() {
        return finalAvgWthCreEar;
    }     public void setStudName(String studName) {
        this.studName = studName;
    }     public void setStudNum(int studNum) {
        this.studNum = studNum;
    }     public void setCoursesTaken(String coursesTaken) {
        this.coursesTaken = coursesTaken;
    }     public void setMidtermMarks(float midtermMarks) {
        this.midtermMarks = midtermMarks;
    }     public void setFinalTermMarks(float finalTermMarks) {
        this.finalTermMarks = finalTermMarks;
    }     public void setTeachComments(String teachComments) {
        this.teachComments = teachComments;
    }     public void setFinalAvgWthCreEar(float finalAvgWthCreEar) {
        this.finalAvgWthCreEar = finalAvgWthCreEar;
    }
} public class SchoolInformation {     public static void main(String[] args) {
        try {
            //method calling for getting student details
            Student stdObj = getStudentDetails();
            //getting the mysql database connection
            Class.forName("com.mysql.jdbc.Driver");
            //3306 -- replace with your database port number
            //test -- replace with your database name
            //root -- replace with your database user name
            //Root -- replace with your database password
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "Root");
            //creating query string for inserting student data
            String query = "insert into studentInfo(studName, studNum, coursesTaken, midtermMarks, finalTermMarks, teachComments,"
                    + " finalAvgWthCreEar) \r\n"
                    + "values(?, ?, ?, ?, ?, ?, ?)";
            PreparedStatement preparedStmt = con.prepareStatement(query);             //setting the values to the prepared statement
            preparedStmt.setString(1, stdObj.getStudName());
            preparedStmt.setInt(2, stdObj.getStudNum());
            preparedStmt.setString(3, stdObj.getCoursesTaken());
            preparedStmt.setFloat(4, stdObj.getMidtermMarks());
            preparedStmt.setFloat(5, stdObj.getFinalTermMarks());
            preparedStmt.setString(6, stdObj.getTeachComments());
            preparedStmt.setFloat(7, stdObj.getFinalAvgWthCreEar());
            

            //executing the insert query
            preparedStmt.execute();
            System.out.println("Student Record is inserted successfully");
            
            //closing the connection object
            con.close();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }     public static Student getStudentDetails() {
        //creating the student object
        Student stdObj = new Student();
        try {
            Scanner sc = new Scanner(System.in);
            //reading all the student details and setting values to student object
            System.out.print("Please enter student name : ");
            String name = sc.nextLine();
            stdObj.setStudName(name);
            System.out.print("Please enter student number : ");
            stdObj.setStudNum(sc.nextInt());
            System.out.print("Please enter student course taken : ");
            sc.nextLine();
            stdObj.setCoursesTaken(sc.nextLine());
            System.out.print("Please enter student mid term marks : ");
            stdObj.setMidtermMarks(sc.nextFloat());
            System.out.print("Please enter student final  term marks : ");
            stdObj.setFinalTermMarks(sc.nextFloat());
            System.out.print("Please enter teacher comments: ");
            sc.nextLine();
            stdObj.setTeachComments(sc.nextLine());
            System.out.print("Please enter student final average with credits earned : ");
            stdObj.setFinalAvgWthCreEar(sc.nextFloat());
            sc.close();
        } catch (Exception e) {
            System.out.println("invalid input entered, Please enter proper values");
        }
        return stdObj;
    }
}  
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education