
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 me with these errors in java. Errors below
public class Student {
//student related variables
//for reading the student information
String studName;
int studNum;
String coursesTaken;
float midtermMarks;
float finalTermMarks;
String teachComments;
float finalAvgWthCreEar;
//setters and getters methods to the above fields
/**
* @return the studName
*/
public String getStudName() {
return studName;
}
/**
* @return the studNum
*/
public int getStudNum() {
return studNum;
}
/**
* @return the coursesTaken
*/
public String getCoursesTaken() {
return coursesTaken;
}
/**
* @return the midtermMarks
*/
public float getMidtermMarks() {
return midtermMarks;
}
/**
* @return the finalTermMarks
*/
public float getFinalTermMarks() {
return finalTermMarks;
}
/**
* @return the teachComments
*/
public String getTeachComments() {
return teachComments;
}
/**
* @return the finalAvgWthCreEar
*/
public float getFinalAvgWthCreEar() {
return finalAvgWthCreEar;
}
/**
* @param studName the studName to set
*/
public void setStudName(String studName) {
this.studName = studName;
}
/**
* @param studNum the studNum to set
*/
public void setStudNum(int studNum) {
this.studNum = studNum;
}
/**
* @param coursesTaken the coursesTaken to set
*/
public void setCoursesTaken(String coursesTaken) {
this.coursesTaken = coursesTaken;
}
/**
* @param midtermMarks the midtermMarks to set
*/
public void setMidtermMarks(float midtermMarks) {
this.midtermMarks = midtermMarks;
}
/**
* @param finalTermMarks the finalTermMarks to set
*/
public void setFinalTermMarks(float finalTermMarks) {
this.finalTermMarks = finalTermMarks;
}
/**
* @param teachComments the teachComments to set
*/
public void setTeachComments(String teachComments) {
this.teachComments = teachComments;
}
/**
* @param finalAvgWthCreEar the finalAvgWthCreEar to set
*/
public void setFinalAvgWthCreEar(float finalAvgWthCreEar) {
this.finalAvgWthCreEar = finalAvgWthCreEar;
}
}
SchoolInformation.java
package Examples;
import java.util.Scanner;
import java.sql.*;
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 {
//creating the scanner class for reading console input
Scanner sc = new Scanner(System.in);
//reading all the student details and setting values to student object
System.out.print("Please enter student name : ");
stdObj.setStudName(sc.nextLine());
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");
}
//returning the student object
return stdObj;
}
}

Transcribed Image Text:>sh -c javac -classpath .:target/dependenc
y/* -d . $(find . -type f -name '*.java')
./Main.java:100: error: class, interface, e
num, or record expected
import java.util.Scanner;
./Main.java:101: error: class, interface, e
num, or record expected
import java.sql.*;
2 errors
exit status 1
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 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
- Q1. amount the same, y, n, why? public class CheckingAct { private String actNum; private String nameOnAct; private int balance; . . . . public void processDeposit( int amount ) { balance = balance + amount ; } // modified toString() method public String toString() { return "Account: " + actNum + "\tName: " + nameOnAct + "\tBalance: " + amount ; } } Q2. amount the same, y, n, why? public class CheckingAct { private String actNum; private String nameOnAct; private int balance; . . . . public void processDeposit( int amount ) { // scope of amount starts here balance = balance + amount ; // scope of amount ends here } public void processCheck( int amount ) { // scope of amount starts here int charge; incrementUse(); if ( balance < 100000 ) charge = 15; else charge = 0; balance = balance - amount - charge ; // scope of amount ends here }…arrow_forwardpublic class ItemToPurchase { private String itemName; private int itemPrice; private int itemQuantity; // Default constructor public ItemToPurchase() { itemName = "none"; itemPrice = 0; itemQuantity = 0; } // Mutator for itemName public void setName(String itemName) { this.itemName = itemName; } // Accessor for itemName public String getName() { return itemName; } // Mutator for itemPrice public void setPrice(int itemPrice) { this.itemPrice = itemPrice; } // Accessor for itemPrice public int getPrice() { return itemPrice; } // Mutator for itemQuantity public void setQuantity(int itemQuantity) { this.itemQuantity = itemQuantity; } // Accessor for itemQuantity public int getQuantity() { return itemQuantity; }} import java.util.Scanner; public class ShoppingCartPrinter { public static void main(String[] args) { Scanner scnr = new…arrow_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_forward
- Flight assignment runs but there is no imput values for the user to interact when running the program. Kindly fix this issue.import java.util.*; class Flight { String airlineCode; int flightNumber; char type; // D for domestic, I for international String departureAirportCode; String departureGate; char departureDay; int departureTime; String arrivalAirportCode; String arrivalGate; char arrivalDay; int arrivalTime; char status; // S for scheduled, A for arrived, D for departed public Flight(String airlineCode, int flightNumber, char type, String departureAirportCode, String departureGate, char departureDay, int departureTime, String arrivalAirportCode, String arrivalGate, char arrivalDay, int arrivalTime) { this.airlineCode = airlineCode; this.flightNumber = flightNumber; this.type = type; this.departureAirportCode = departureAirportCode; this.departureGate = departureGate;…arrow_forwardthis is my retail item code: //Import statements public class RetailItem { private String description; private int units; private double price; public RetailItem() { } public RetailItem(String x, int y, double z) { description = x; units = y; price = z; } public RetailItem(RetailItem i) { } public void setDescription(String x) { description = x; } public void setPrice(double z) { price = z; } void setUnits(int y) { units = y; } public int getUnits() { return units; } public String getDescription() { return description; } public double getPrice() { return price; } // Main class public static void main(String[] args) { String str = "Shirt"; RetailItem r1 = new RetailItem("Jacket", 12,…arrow_forward
arrow_back_ios
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