Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.55 KB | None | 0 0
  1. import java.util.Collections;
  2. import java.util.ArrayList;
  3. import java.sql.DriverManager;
  4. import java.sql.Connection;
  5. import java.sql.SQLException;
  6. import java.util.Date;
  7. import java.math.*;
  8.  
  9. class Customer
  10. {
  11.     private int id;
  12.     private String firstname;
  13.     private String lastname;
  14.     private String address1;
  15.     private String address2;
  16.     private String city;
  17.     private String state;
  18.     private int zip;
  19.     private String country;
  20.     private short region;
  21.     private String email;
  22.     private String phone;
  23.     private String creditCardType;
  24.     private String creditCard;
  25.     private String creditCardExpiration;
  26.     private String username;
  27.     private String password;
  28.     private short age;
  29.     private int income;
  30.     private char gender;
  31.    
  32.     public int getId() { return this.id; }
  33.     public void setId(int value) { this.id = value; }
  34.    
  35.     public String getFirstname() { return this.firstname; }
  36.     public void setFirstname(String value) { this.firstname = value; }
  37.  
  38.     public String getLastname() { return this.lastname; }
  39.     public void setLastname(String value) { this.lastname = value; }
  40.    
  41.     public String getAddress1() { return this.address1; }
  42.     public void setAddress1(String value) { this.address1 = value; }
  43.  
  44.     public String getAddress2() { return this.address2; }
  45.     public void setAddress2(String value) { this.address2 = value; }
  46.    
  47.     public String getCity() { return this.city; }
  48.     public void setCity(String value) { this.city = value; }
  49.    
  50.     public String getState() { return this.state; }
  51.     public void setState(String value) { this.state = value; }
  52.    
  53.     public int getZip() { return this.zip; }
  54.     public void setZip(int value) { this.zip = value; }
  55.    
  56.     public String getCountry() { return this.country; }
  57.     public void setCountry(String value) { this.country = value; }
  58.    
  59.     public short getRegion() { return this.region; }
  60.     public void setRegion(short value) { this.region = value; }
  61.    
  62.     public String getEmail() { return this.email; }
  63.     public void setEmail(String value) { this.email = value; }
  64.    
  65.     public String getPhone() { return this.phone; }
  66.     public void setPhone(String value) { this.phone = value; }
  67.    
  68.     public String getCreditCardType() { return this.creditCardType; }
  69.     public void setCreditCardType(String value) { this.creditCardType = value; }
  70.    
  71.     public String getCreditCard() { return this.creditCard; }
  72.     public void setCreditCard(String value) { this.creditCard = value; }
  73.    
  74.     public String getCreditCardExpiration() { return this.creditCardExpiration; }
  75.     public void setCreditCardExpiration(String value) { this.creditCardExpiration = value; }
  76.    
  77.     public String getUsername() { return this.username; }
  78.     public void setUsername(String value) { this.username = value; }
  79.    
  80.     public String getPassword() { return this.password; }
  81.     public void setPassword(String value) { this.password = value; }
  82.    
  83.     public short getAge() { return this.age; }
  84.     public void setAge(short value) { this.age = value; }
  85.    
  86.     public int getIncome() { return this.income; }
  87.     public void setIncome(int value) { this.income = value; }
  88.    
  89.     public char getGender() { return this.gender; }
  90.     public void setGender(char value) { this.gender = value; }
  91.    
  92.     public Customer()
  93.     {
  94.        
  95.     }
  96.    
  97.     public Customer(int id, String firstname, String lastname, String address1, String address2,
  98.                     String city, String state, int zip, String country, short region, String email,
  99.                     String phone, String creditCardType, String creditCard, String creditCardExpiration,
  100.                     String username, String password, short age, int income, char gender)
  101.     {
  102.         this.id = id;
  103.         this.firstname = firstname;
  104.         this.lastname = lastname;
  105.         this.address1 = address1;
  106.         this.address2 = address2;
  107.         this.city = city;
  108.         this.state = state;
  109.         this.zip = zip;
  110.         this.country = country;
  111.         this.region = region;
  112.         this.email = email;
  113.         this.phone = phone;
  114.         this.creditCardType = creditCardType;
  115.         this.creditCard = creditCard;
  116.         this.creditCardExpiration = creditCardExpiration;
  117.         this.username = username;
  118.         this.password = password;
  119.         this.age = age;
  120.         this.income = income;
  121.         this.gender = gender;
  122.     }
  123. }
  124.  
  125. class Order
  126. {
  127.     private int id;
  128.     private Date orderDate;
  129.     private int customerId;
  130.     private BigDecimal netAmount;
  131.     private BigDecimal tax;
  132.     private BigDecimal totalAmount;
  133.    
  134.     public int getId() { return this.id; }
  135.     public void setId(int value) { this.id = value; }
  136.    
  137.     public Date getOrderDate() { return this.orderDate; }
  138.     public void setOrderDate(Date value) { this.orderDate = value; }
  139.    
  140.     public int getCustomerId() { return this.customerId; }
  141.     public void setCustomerId(int value) { this.customerId = value; }
  142.    
  143.     public BigDecimal getNetAmount() { return this.netAmount; }
  144.     public void setNetAmount(BigDecimal value) { this.netAmount = value; }
  145.    
  146.     public BigDecimal getTax() { return this.tax; }
  147.     public void setTax(BigDecimal value) { this.tax = value; }
  148.    
  149.     public BigDecimal getTotalAmount() { return this.totalAmount; }
  150.     public void setTotalAmount(BigDecimal value) { this.totalAmount = value; }
  151.    
  152.     public Order()
  153.     {
  154.        
  155.     }
  156.    
  157.     public Order(int id, Date orderDate, int customerId, BigDecimal netAmount, BigDecimal tax, BigDecimal totalAmount)
  158.     {
  159.         this.id = id;
  160.         this.orderDate = orderDate;
  161.         this.customerId = customerId;
  162.         this.netAmount = netAmount;
  163.         this.tax = tax;
  164.         this.totalAmount = totalAmount;
  165.     }
  166. }
  167.  
  168. class OrderLine
  169. {
  170.     private int id;
  171.     private int orderId;
  172.     private int prodId;
  173.     private int quantity;
  174.     private Date orderDate;
  175.    
  176.     public int getId() { return this.id; }
  177.     public void setId(int value) { this.id = value; }
  178.    
  179.     public int getOrderId() { return this.orderId; }
  180.     public void setOrderId(int value) { this.orderId = value; }
  181.    
  182.     public int getProdId() { return this.prodId; }
  183.     public void setProdId(int value) { this.prodId = value; }
  184.    
  185.     public int getQuantity() { return this.quantity; }
  186.     public void setQuantity(int value) { this.quantity = value; }
  187.    
  188.     public Date getOrderDate() { return this.orderDate; }
  189.     public void setOrderDate(Date value) { this.orderDate = value; }
  190.    
  191.     public OrderLine()
  192.     {
  193.        
  194.     }
  195.    
  196.     public OrderLine(int id, int orderId, int prodId, int quantity, Date orderDate)
  197.     {
  198.         this.id = id;
  199.         this.orderId = orderId;
  200.         this.prodId = prodId;
  201.         this.quantity = quantity;
  202.         this.orderDate = orderDate;
  203.     }
  204. }
  205.  
  206. // The classic Hello World program!
  207. class Test {
  208.    
  209.    public ArrayList<Order> f1()
  210.    {
  211.        String url = "jdbc:postgresql://localhost/performance?user=performancetest&password=performancetest&ssl=true";
  212.        Connection c = null;
  213.        try {
  214.            c = DriverManager.getConnection(url);
  215.            
  216.            ArrayList<Order> list = new ArrayList<Order>();
  217.            return list;
  218.        }
  219.        catch (SQLException se)
  220.        {
  221.            throw se;
  222.        }
  223.        finally
  224.        {
  225.            
  226.        }
  227.    }
  228.    
  229.    public static void main(String[] args) {
  230.      
  231.       //Write Hello World to the terminal window
  232.       System.out.println("Hello World!");
  233.      
  234.    }
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement