Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ClothingItemShop;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- public class EveningDress extends ClothingItemShop {
- private static float box_price;
- public EveningDress(float price_param, float weight_param, String color_param, String colorPattern_param,
- String size_param, String fabric_param) {
- super(price_param, weight_param, color_param, colorPattern_param, size_param, fabric_param);
- }
- static {
- try {
- Connection connection = null;
- Statement statement = null;
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/clothingitem", "root", "123456");
- statement = connection.createStatement();
- ResultSet result = statement
- .executeQuery("SELECT container_price FROM containers WHERE item_type = 'Dress'");
- while (result.next()) {
- box_price = result.getFloat("container_price");
- System.out.println("The box price for the Dress is: " + box_price);
- }
- result.close();
- statement.close();
- connection.close();
- } catch (Exception e) {
- System.out.print(e);
- }
- }
- public float getContainerPrice() {
- return box_price;
- }
- public float getItemPrice() {
- return price;
- }
- public float getWeight() {
- return weight;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement