
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 4 images

Knowledge Booster
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
- Written in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardpublic class Plant { protected String plantName; protected String plantCost; public void setPlantName(String userPlantName) { plantName = userPlantName; } public String getPlantName() { return plantName; } public void setPlantCost(String userPlantCost) { plantCost = userPlantCost; } public String getPlantCost() { return plantCost; } public void printInfo() { System.out.println(" Plant name: " + plantName); System.out.println(" Cost: " + plantCost); }} public class Flower extends Plant { private boolean isAnnual; private String colorOfFlowers; public void setPlantType(boolean userIsAnnual) { isAnnual = userIsAnnual; } public boolean getPlantType(){ return isAnnual; } public void setColorOfFlowers(String userColorOfFlowers) { colorOfFlowers = userColorOfFlowers; } public String getColorOfFlowers(){ return colorOfFlowers; } @Override public void printInfo(){…arrow_forwardProgram: File GamePurse.h: class GamePurse { // data int purseAmount; public: // public functions GamePurse(int); void Win(int); void Loose(int); int GetAmount(); }; File GamePurse.cpp: #include "GamePurse.h" // constructor initilaizes the purseAmount variable GamePurse::GamePurse(int amount){ purseAmount = amount; } // function definations // add a winning amount to the purseAmount void GamePurse:: Win(int amount){ purseAmount+= amount; } // deduct an amount from the purseAmount. void GamePurse:: Loose(int amount){ purseAmount-= amount; } // return the value of purseAmount. int GamePurse::GetAmount(){ return purseAmount; } File main.cpp: // include necessary header files #include <stdlib.h> #include "GamePurse.h" #include<iostream> #include<time.h> using namespace std; int main(){ // create the object of GamePurse class GamePurse dice(100); int amt=1; // seed the random generator srand(time(0)); // to play the…arrow_forward
- CSC 1302: PRINCIPLES OF COMPUTER SCIENCE II Lab 6 How to Submit Please submit your answers to the lab instructor once you have completed. Failure to submit will result in a ZERO FOR THIS LAB. NO EXCEPTIONS. The class diagram with four classes Student, Graduate, Undergraduate, and Exchange is given. Write the classes as described in the class diagram. The fields and methods for each class is given below. Student Exchange Graduate Undergraduate Student: Fields: major (String) gpa (double) creditHours (int) Methods: getGpa: returns gpa getYear: returns “freshman”, “sophomore”, “junior” or “senior” as determined by earned credit hours: Freshman: Less than 32 credit hours Sophomore: At least 32 credit hours but less than 64 credit hours Junior: At least credit hours 64 but less than 96 credit hours Senior: At least 96 credit hours Graduate:…arrow_forwardJava Type the set up for a Class named Student with the following data fields, name, idNumber, gpa, address, and age. Include get and set methods for each data field.arrow_forwardQuestion 6 Consider: class Bike { } private String color; public Bike() { } public Bike(String newColor) { color = newColor; } public Bike (Bike bike) { color = } bike.color; public String getColor() { } } return color; public void setColor(String newColor) { color = newColor; Bike bike1= new Bike(); = Bike bike2 new Bike("blue"); Bike bike3 = new Bike(bike2); bike2.setColor("green"); Bike bike4 = new Bike(bike2); Which of the following are correct? bike4.getColor() returns null bike4.getColor() return "blue" bike3.getColor() return "green" bike2.getColor() returns "blue" bike4.getColor() return "green" bike1.getColor() returns bike3.getColor() return null bike3.getColor() returns "blue" bike2.getColor() returns "green" bike1.getColor() returns nullarrow_forward
- class Student: def __init__(self, id, fn, ln, dob, m='undefined'): self.id = id self.firstName = fn self.lastName = ln self.dateOfBirth = dob self.Major = m def set_id(self, newid): #This is known as setter self.id = newid def get_id(self): #This is known as a getter return self.id def set_fn(self, newfirstName): self.fn = newfirstName def get_fn(self): return self.fn def set_ln(self, newlastName): self.ln = newlastName def get_ln(self): return self.ln def set_dob(self, newdob): self.dob = newdob def get_dob(self): return self.dob def set_m(self, newMajor): self.m = newMajor def get_m(self): return self.m def print_student_info(self): print(f'{self.id} {self.firstName} {self.lastName} {self.dateOfBirth} {self.Major}')all_students = []id=100user_input = int(input("How many students: "))for x in range(user_input): firstName = input('Enter…arrow_forwardConsider the following code: class Player { private: string ID; string name; public: Player(string n, string s) { name = n; setID(s); } string getName() const { return name; } string getID() const { return ID; } void setID(string s) { ID = s; } }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, string i, int fg, int a) : Player(n, i) { fieldgoals = fg; attempts = a; } // line 1 void printStats() const { cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; int main() { Player golfer("Tiger Woods", "123456789"); BasketballPlayer pointGuard("Stephen Curry", "567890123", 2585, 5523); } Describe the code : Player(n, i) at the end of the BasketballPlayer constructor. a. calls the Player constructor with parameters n, i c. derives Player from BasketballPlayer d. derives BasketballPlayer from Player e. calls the Player…arrow_forwardclass smart { public: void print() const; void set(int, int); int sum(); smart(); smart(int, int); private: int x; int y; int secret(); }; class superSmart: public smart { public: void print() const; void set(int, int, int); int manipulate(); superSmart(); superSmart(int, int, int); private: int z; }; Now answer the following questions: a. Which private members, if any, of smart are public members of superSmart? b. Which members, functions, and/or data of the class smart are directly accessible in class superSmart?arrow_forward
- Question p .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forward// This class discounts prices by 10% public class DebugFour4 { public static void main(String args[]) { final double DISCOUNT_RATE = 0.90; int price = 100; double price2 = 100.00; tenPercentOff(price DISCOUNT_RATE); tenPercentOff(price2 DISCOUNT_RATE); } public static void tenPercentOff(int p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println("Ten percent off " + p); System.out.println(" New price is " + newPrice); } public static void tenPercentOff(double p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println"Ten percent off " + p); System.out.println(" New price is " + newprice); } }arrow_forwardclass IndexItem { public: virtual int count() = 0; virtual void display()= 0; };class Book : public IndexItem { private: string title; string author; public: Book(string title, string author): title(title), author(author){} virtual int count(){ return 1; } virtual void display(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };class Category: public IndexItem { private: /* fill in the private member variables for the Category class below */ ? int count; public: Category(string name, string code): name(name), code(code){} /* Implement the count function below. Consider the use of the function as depicted in main() */ ? /* Implement the add function which fills the category with contents below. Consider the use of the function as depicted in main() */ ? virtualvoiddisplay(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education