Tuesday, May 7, 2013

MVC Example

MODEL

Model.java
/*******************************************************************/
/*******************************************************************/
/*                   Created By Nate Nesler                        */
/* =============================================================== */
/*                       Date 05/05/2013                           */
/* --------------------------------------------------------------- */
/*                         Class Model                             */
/* =============================================================== */
/* Class Description - the Model aspect of the MVC.  This class    */
/*                     acts as the main access point to the data   */
/*                     portion of the overall application.  For    */
/*                     this reason this class is setup as a        */
/*                     singleton.                                  */
/* --------------------------------------------------------------- */
/* method InitializeDB() - creates a single database connection    */
/*                         that all other database classes share   */
/*                         and use in order to send SQL statments  */
/*                         to the database.                        */
/* --------------------------------------------------------------- */
/* database object Cars - is a class interface that allows access  */
/*                        to the Cars database table.              */
/*******************************************************************//*******************************************************************/

import java.sql.*;
import java.util.List;
import java.util.ArrayList;

public class Model
{
    /*******************************************************************/
    /*                      Create Singleton                           */
    /*******************************************************************/
    public final static Model Instance = new Model();
   
    Statement dbSql;
    Connection dbConnection;
    CarModel cars = new CarModel();
        public Model()
    {
        InitializeDB();
    }

    /*******************************************************************/
    /*                   Initialize Database Method                    */
    /* =============================================================== */
    /* InitializeDB() - creates a single access point to the CarsRUs   */
    /*                  Database so that multiple database model       */
    /*                  classes can access the database without        */
    /*                  creating multiple database connections.        */
    /*******************************************************************/

    private void InitializeDB()
    {
        try
        {
            // Load the driver
            Class.forName("com.mysql.jdbc.Driver");
            // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

            // Connect to the ODBC - Access database
            dbConnection = DriverManager.getConnection("jdbc:mysql://localhost/CarsRUs", "root", "password");     
            // conn = DriverManager.getConnection("jdbc:odbc:Cars", "", "" );
            // Create a statement
            dbSql = dbConnection.createStatement();
        }
        catch (Exception ex)
        {
            System.out.println("Connection failed: " + ex);
        }
    }
}

CarModel.java

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/*******************************************************************/
/*******************************************************************/
/*                   Created By Nate Nesler                        */
/* =============================================================== */
/*                       Date 05/05/2013                           */
/* --------------------------------------------------------------- */
/*                        Class CarModel                           */
/* =============================================================== */
/* Class Description - car object represents a car at a car        */
/*                     dealership lot.                             */
/* --------------------------------------------------------------- */
/* method findAll() - returns all of the car objects in the        */
/*                    database.                                    */
/* method search() - returns the car objects based on the model    */
/*                   and the make in the database.                 */
/* method insert() - creates a database record of a car object in  */
/*                   the database.                                 */
/* method update() - changes a database record of a car object in  */
/*                   the database.                                 */
/* method delete() - deletes a database record of a car object in  */
/*                   the database.                                 */
/*******************************************************************/
/*******************************************************************/

public class CarModel implements CarService
{

    /*******************************************************************/
    /*                       Find All Method                           */
    /* =============================================================== */
    /* findAll() - uses a select statement to return all of the cars   */
    /*             in the CarsRUs database from the Cars table.        */
    /*             Returns a List of Car Objects.                      */
    /*******************************************************************/

    public List<Car> findAll()
    {
        List<Car> result = new ArrayList<Car>();

        // Build a SQL SELECT statement
        String query = "SELECT * FROM Cars";

        try
        {
            // Execute query
            ResultSet queryResults = Model.Instance.dbSql.executeQuery(query);

            while( queryResults.next() )
            {
                Car car = new Car( queryResults.getInt(1),
                                   queryResults.getString(2),
                                   queryResults.getString(3),
                                   queryResults.getString(4),
                                   queryResults.getString(5),
                                   queryResults.getString(7),
                                   queryResults.getString(6),
                                   queryResults.getString(8)
                                 );
                result.add(car);   
            }
        }
        catch(SQLException ex)
        {
            System.out.println("Select failed: " + ex);
        }
        return result;
    }
   
    /*******************************************************************/
    /*                         Search Method                           */
    /* =============================================================== */
    /* search() - uses a select statement to return cars based on      */
    /*            their make and model in the CarsRUs database from    */
    /*            the Cars table.                                      */
    /*            Returns a List of Car Objects.                       */
    /*******************************************************************/

    public List<Car> search(String keyword)
    {
        List<Car> result = new ArrayList<Car>();

        // Build a SQL SELECT statement
        String query = "SELECT * FROM Cars WHERE Make = "
          + "'" + keyword.trim() + "' OR Model = " + "'" + keyword.trim() + "'";

        try
        {
            // Execute query
            System.out.println(query);
            ResultSet queryResults = Model.Instance.dbSql.executeQuery(query);

            while( queryResults.next() )
            {
                Car car = new Car( queryResults.getInt(1),
                                   queryResults.getString(2),
                                   queryResults.getString(3),
                                   queryResults.getString(4),
                                   queryResults.getString(5),
                                   queryResults.getString(7),
                                   queryResults.getString(6),
                                   queryResults.getString(8)
                                 );
                result.add(car);   
            }
        }
        catch(SQLException ex)
        {
            System.out.println("Select failed: " + ex);
        }

        return result;
    }
       
    /*******************************************************************/
    /*                         Insert Method                           */
    /* =============================================================== */
    /* insert() - uses a insert statement to create a record in the    */
    /*            in the CarsRUs database from the Cars table.         */
    /*            Returns nothing.                                     */
    /*******************************************************************/

    public void insert(Car car)
    {
        // Build a SQL INSERT statement
        String insertSql =
          "INSERT INTO Cars(VinNumber, TrimLevel, Model, Make, " +
          " PreviewImage, Description, Price) VALUES('" +
          car.getVinNumber() + "','" +
          car.getTrimLevel() + "','" +
          car.getModel() + "','" +
          car.getMake() + "','" +
          car.getDescription() + "','" +
          car.getPreview() + "','" +
          car.getPrice() + "');";

        try
        {
            System.out.println(insertSql);
            Model.Instance.dbSql.executeUpdate(insertSql);
        }
        catch (SQLException ex)
        {
            System.out.println("Insertion failed: " + ex);
        }
    }

    /*******************************************************************/
    /*                         Update Method                           */
    /* =============================================================== */
    /* update() - uses a update statement to change a record in the    */
    /*            in the CarsRUs database from the Cars table.         */
    /*            Returns nothing.                                     */
    /*******************************************************************/

    public void update(Car car)
    {
        // Build a SQL UPDATE statement
        String updateStmt = "UPDATE Cars " +
          "SET VinNumber = '" + car.getVinNumber() + "'," +
          "TrimLevel = '" + car.getTrimLevel() + "'," +
          "Model = '" + car.getModel() + "'," +
          "Make = '" + car.getMake() + "'," +
          "PreviewImage = '" + car.getPreview() + "'," +
          "Description = '" + car.getDescription() + "'," +
          "Price = '" + car.getPrice() + "' " +
          "WHERE ID = '" + car.getId() + "'";

        try
        {
            System.out.println(updateStmt);
            Model.Instance.dbSql.executeUpdate(updateStmt);
            System.out.println("Record updated");
        }
        catch(SQLException ex)
        {
            System.out.println("Update failed: " + ex);
        }
    }   

    /*******************************************************************/
    /*                         Delete Method                           */
    /* =============================================================== */
    /* delete() - uses a delete statement to remove a record in the    */
    /*            in the CarsRUs database from the Cars table.         */
    /*            Returns nothing.                                     */
    /*******************************************************************/

    public void delete(Car car)
    {
        // Build a SQL DELETE statement
        String updateStmt = "DELETE FROM Cars " +
          "WHERE ID = " + car.getId();

        try
        {
            System.out.println(updateStmt);
            Model.Instance.dbSql.executeUpdate(updateStmt);
            System.out.println("Record updated");
        }
        catch(SQLException ex)
        {
            System.out.println("Update failed: " + ex);
        }
    }   
}

Controller

Controller.java

package carsrus;

import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;

/*******************************************************************/
/*******************************************************************/
/*                   Created By Nate Nesler                        */
/* =============================================================== */
/*                       Date 05/05/2013                           */
/* --------------------------------------------------------------- */
/*                       Class Controller                          */
/* =============================================================== */
/* Class Description - the Controller aspect of the MVC.  This     */
/*                     class acts as the main access point to the  */
/*                     logic portion of the overall application.   */
/*                     For this reason this class is setup as a    */
/*                     singleton.                                  */
/* --------------------------------------------------------------- */
/* method InitializeDB() - creates a single database connection    */
/*                         that all other database classes share   */
/*                         and use in order to send SQL statments  */
/*                         to the database.                        */
/* --------------------------------------------------------------- */
/* property model - is a class interface that allows access to the */
/*                  Cars and Users database table.                 */
/* property view - is a class interface that allows access to the  */
/*                 GUI of the View part of MVC.                    */
/* property user - is a class interface that allows access to the  */
/*                 presistant user account.  This variable         */
/*                 represents the currently logged in user in the  */
/*                 application.                                    */
/* property car - is a class interface that allows access to the   */
/*                 presistant car that is currently being viewed   */
/*                 in the View portion of the application.         */
/* property cars - is a class interface that allows access to the  */
/*                 presistant list of cars that is returned from   */
/*                 the database and can be viewed in the View      */
/*                 portion of the application.                     */
/* --------------------------------------------------------------- */
/* method login() - logins into a user account by getting the data */
/*                  inputed by the user and then sees if the       */
/*                  exists in the database.  Then the method       */
/*                  checks to see if the password in the database  */
/*                  matches the password inputed by the user.  If  */
/*                  everything checks out then the menu system is  */
/*                  enabled and the login panel's visibility is    */
/*                  set to false and the car panel's visibility is */
/*                  set to true.  If the login does not check out  */
/*                  then login panel stays visible, car panel      */
/*                  stays invisible, and the menu system stays     */
/*                  disabled.                                      */
/* method clearCarView() - sets all of the text to "" thus         */
/*                         clearing all of the TextFields in the   */
/*                         car panel View GUI interface.           */
/* method loadCarInView() - loads a car object in the View GUI     */
/*                          interface in the TextFields in the car */
/*                          panel.                                 */
/* method createCarFromView() - creates a car object from the View */
/*                              GUI interface car panel TextFields */
/* method insert() - creates a car object from the View GUI        */
/*                   interface car panel TextFields and creates a  */
/*                   record in the database Cars table.            */
/* method update() - creates a car object from the View GUI        */
/*                   interface car panel TextFields and changes a  */
/*                   record in the database Cars table.            */
/* method delete() - creates a car object from the View GUI        */
/*                   interface car panel TextFields and deletes a  */
/*                   record in the database Cars table.            */
/* method search() - gets the text from the View GUI interface     */
/*                   jTxtFdSearch and gets all the match records   */
/*                   as a list of cars in the database Cars table. */
/* method previous() - selects the previous car from the search    */
/*                     results to be displayed.                    */
/* method next() - selects the next car from the search results to */
/*                 be displayed.                                   */
/*******************************************************************/
/*******************************************************************/

public class Controller
{
    /*******************************************************************/
    /*                      Create Singleton                           */
    /*******************************************************************/
    public final static Controller Instance = new Controller();
   
    /*******************************************************************/
    /*                Create Persistant User Account                   */
    /*******************************************************************/
    public static   User        user;
    public          List<Car>   cars    = new ArrayList<Car>();
    public          Car         car     = new Car();
    private         Model       model   = Model.Instance;
    private         View        view    = View.Instance;
    private         Integer     index   = 0;   
    private         String      keyword = "";   

    /*******************************************************************/
    /*                         Method Login                            */
    /* =============================================================== */
    /* logins into a user account by getting the data inputed by the   */
    /* user and then sees if the exists in the database.  Then the     */
    /* method checks to see if the password in the database matches    */
    /* the password inputed by the user.  If everything checks out     */
    /* then the menu system is enabled and the login panel's           */
    /* visibility is set to false and the car panel's visibility is    */
    /* set to true.  If the login does not check out then login panel  */
    /* stays visible, car panel stays invisible, and the menu system   */
    /* stays disabled.                                                 */
    /*******************************************************************/
   
    public boolean login()
    {  
        user = model.users.search( View.Instance.jTxtFdUsername.getText().trim() );
        if ( View.Instance.jPassFdPassword.getText().trim().equals( user.getPassword() ) )
        {
            View.Instance.fileMenu.setEnabled(true);
            View.Instance.helpMenu.setEnabled(true);
            View.Instance.jpanLogin.setVisible(false);
            View.Instance.jpanCars.setVisible(true);
           
            return true;
        }
        else
        {
            View.Instance.fileMenu.setEnabled(false);
            View.Instance.helpMenu.setEnabled(false);
            View.Instance.jpanLogin.setVisible(true);
            View.Instance.jpanCars.setVisible(false);
           
            return false;
        }
    }
   
    /*******************************************************************/
    /*                      Method Clear Car View                      */
    /* =============================================================== */
    /* sets all of the text to "" thus clearing all of the TextFields  */
    /* in the car panel View GUI interface.                            */
    /*******************************************************************/
   
    public void clearCarView()
    {
        View.Instance.jTxtFdVinNumber.setText("");
        View.Instance.jTxtFdTrimLevel.setText("");
        View.Instance.jTxtFdModel.setText("");
        View.Instance.jTxtFdMake.setText("");
        View.Instance.jTxtFdPreview.setText("");
        View.Instance.jTxtFdDescription.setText("");
        View.Instance.jTxtFdPrice.setText("");       
        index = 0;
    }
   
    /*******************************************************************/
    /*                     Method Load Car In View                     */
    /* =============================================================== */
    /* loads a car object in the View GUI interface in the TextFields  */
    /* in the car panel.                                               */
    /*******************************************************************/
   
    public void loadCarInView(Car car)
    {
        View.Instance.jTxtFdId.setText( car.getId().toString() );
        View.Instance.jTxtFdVinNumber.setText( car.getVinNumber() );
        View.Instance.jTxtFdTrimLevel.setText( car.getTrimLevel() );
        View.Instance.jTxtFdModel.setText( car.getModel() );
        View.Instance.jTxtFdMake.setText( car.getMake() );
        View.Instance.jTxtFdPreview.setText( car.getPreview() );
        View.Instance.jTxtFdDescription.setText( car.getDescription() );
        View.Instance.jTxtFdPrice.setText( car.getPrice() );
        View.Instance.icon = new ImageIcon( car.getPreview() );
        View.Instance.jlblImg.setIcon(View.Instance.icon);
    }
   
    /*******************************************************************/
    /*                 Method Create Car From View                     */
    /* =============================================================== */
    /* creates a car object from the View GUI interface car panel      */
    /* TextFields.                                                     */
    /*******************************************************************/
   
    public void createCarFromView()
    {
        this.car = new Car( Integer.parseInt( View.Instance.jTxtFdId.getText().trim() ),
                           View.Instance.jTxtFdVinNumber.getText().trim(),
                           View.Instance.jTxtFdTrimLevel.getText().trim(),
                           View.Instance.jTxtFdModel.getText().trim(),
                           View.Instance.jTxtFdMake.getText().trim(),
                           View.Instance.jTxtFdPreview.getText().trim(),
                           View.Instance.jTxtFdDescription.getText().trim(),
                           View.Instance.jTxtFdPrice.getText().trim()
                         );
    }
   
    /*******************************************************************/
    /*                          Method Insert                          */
    /* =============================================================== */
    /* creates a car object from the View GUI interface car panel      */
    /* TextFields and creates a record in the database Cars table.     */
    /*******************************************************************/
   
    public void insert()
    {
        createCarFromView();
        model.cars.insert( car );
        searchKeyword(keyword);
    }
   
    /*******************************************************************/
    /*                          Method Update                          */
    /* =============================================================== */
    /* creates a car object from the View GUI interface car panel      */
    /* TextFields and changes a record in the database Cars table.     */
    /*******************************************************************/
   
    public void update()
    {
        createCarFromView();
        model.cars.update( car );
    }
   
    /*******************************************************************/
    /*                          Method Delete                          */
    /* =============================================================== */
    /* creates a car object from the View GUI interface car panel      */
    /* TextFields and deletes a record in the database Cars table.     */
    /*******************************************************************/
   
    public void delete()
    {
        createCarFromView();
        model.cars.delete( car );
        searchKeyword(keyword);
    }
   
    /*******************************************************************/
    /*                          Method Search                          */
    /* =============================================================== */
    /* gets the text from the View GUI interface jTxtFdSearch and gets */
    /* all the match records as a list of cars in the database Cars    */
    /* table.                                                          */
    /*******************************************************************/
   
    public void searchKeyword(String keyword)
    {
        this.keyword = keyword;
        cars = model.cars.search( keyword );
        index = 0;
        if (cars.size() > 0)
        {
            car = cars.get(index);
            loadCarInView( car );
        }
    }

    public void search()
    {
        searchKeyword( View.Instance.jTxtFdSearch.getText().trim() );
    }

    /*******************************************************************/
    /*                        Method Previous                          */
    /* =============================================================== */
    /* selects the previous car from the search results to be          */
    /* displayed.                                                      */
    /*******************************************************************/
   
    public void previous()
    {
        if ((index - 1) >= 0)
        {
            car = cars.get(--index);
        }
        loadCarInView( car );
    }

    /*******************************************************************/
    /*                           Method Next                           */
    /* =============================================================== */
    /* selects the next car from the search results to be displayed.   */
    /*******************************************************************/
   
    public void next()
    {
        if ((index + 1) < cars.size())
        {
            car = cars.get(++index);
        }
        loadCarInView( car );
    }
}

Main Class
CarsRUs.java

package carsrus;

/*******************************************************************/
/*******************************************************************/
/*                   Created By Nate Nesler                        */
/* =============================================================== */
/*                       Date 05/05/2013                           */
/* --------------------------------------------------------------- */
/*                    Program Name: CarsRUs                        */
/* =============================================================== */
/* Program Description - This program allows a user to login       */
/*                       against a database username and password  */
/*                       account system and then access the        */
/*                       CarsRUs database to make changes to this  */
/*                       database along with looking up car        */
/*                       information for a car dealership.         */
/*******************************************************************/
/*******************************************************************/

public class CarsRUs
{
    public static void main(String[] args)
    {
        View view = View.Instance;
    }
}

Car Class

Car.java

package carsrus;

/*******************************************************************/
/*******************************************************************/
/*                   Created By Nate Nesler                        */
/* =============================================================== */
/*                       Date 05/05/2013                           */
/* --------------------------------------------------------------- */
/*                          Class Car                              */
/* =============================================================== */
/* Class Description - car object represents a car at a car        */
/*                     dealership lot.                             */
/* --------------------------------------------------------------- */
/* property id - will hold the id number from a database record.   */
/* property vinNumber - holds the vin number from a database       */
/*                      record.                                    */
/* property trimLevel - holds the trim level from a database       */
/*                      record.                                    */
/* property model - holds the model from a database record.        */
/* property make - holds the make from a database record.          */
/* property preview - holds the preview image from a database      */
/*                    record.                                      */
/* property description - holds the description from a database    */
/*                        record.                                  */
/* property price - holds the price from a database record.        */
/*******************************************************************/
/*******************************************************************/

public class Car
{
    private Integer id;
    private String vinNumber;
    private String trimLevel;
    private String model;
    private String make;
    private String preview;
    private String description;
    private String price;
   
    public Car()
    {
       
    }

    public Car(Integer id, String vinNumber, String trimLevel, String model, String make, String description, String preview, String price)
    {
        this.id = id;
        this.vinNumber = vinNumber;
        this.trimLevel = trimLevel;
        this.model = model;
        this.make = make;
        this.preview = preview;
        this.description = description;
        this.price = price;
    }

    public Integer getId()
    {
        return id;
    }

    public void setId(Integer id)
    {
        this.id = id;
    }

    public String getPreview()
    {
        return preview;
    }

    public void setPreview(String preview)
    {
        this.preview = preview;
    }

    public String getDescription()
    {
        return description;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    public String getPrice()
    {
        return price;
    }

    public void setPrice(String price)
    {
        this.price = price;
    }

    public String getModel()
    {
        return model;
    }

    public void setModel(String model)
    {
        this.model = model;
    }

    public String getMake()
    {
        return make;
    }

    public void setMake(String make)
    {
        this.make = make;
    }

    public String getVinNumber()
    {
        return vinNumber;
    }

    public void setVinNumber(String vinNumber)
    {
        this.vinNumber = vinNumber;
    }

    public String getTrimLevel()
    {
        return trimLevel;
    }

    public void setTrim(String trimLevel)
    {
        this.trimLevel = trimLevel;
    }
}

Car Implementation Class

CarService.java

package carsrus;

/*******************************************************************/
/*******************************************************************/
/*                   Created By Nate Nesler                        */
/* =============================================================== */
/*                       Date 05/05/2013                           */
/* --------------------------------------------------------------- */
/*                       Class CarService                          */
/* =============================================================== */
/* Class Description - car object represents a car at a car        */
/*                     dealership lot.                             */
/* --------------------------------------------------------------- */
/* method findAll() - returns all of the car objects in the        */
/*                    database.                                    */
/* method search() - returns the car objects based on the model    */
/*                   and the make in the database.                 */
/* method insert() - creates a database record of a car object in  */
/*                   the database.                                 */
/* method update() - changes a database record of a car object in  */
/*                   the database.                                 */
/* method delete() - deletes a database record of a car object in  */
/*                   the database.                                 */
/*******************************************************************/
/*******************************************************************/

import java.util.List;

public interface CarService
{
    /*******************************************************************/
    /*                       Find All Method                           */
    /* =============================================================== */
    /* findAll() - uses a select statement to return all of the cars   */
    /*             in the CarsRUs database from the Cars table.        */
    /*             Returns a List of Car Objects.                      */
    /*******************************************************************/

    public List<Car> findAll();

    /*******************************************************************/
    /*                         Search Method                           */
    /* =============================================================== */
    /* search() - uses a select statement to return cars based on      */
    /*            their make and model in the CarsRUs database from    */
    /*            the Cars table.                                      */
    /*            Returns a List of Car Objects.                       */
    /*******************************************************************/

    public List<Car> search(String keyword);

    /*******************************************************************/
    /*                         Insert Method                           */
    /* =============================================================== */
    /* insert() - uses a insert statement to create a record in the    */
    /*            in the CarsRUs database from the Cars table.         */
    /*            Returns nothing.                                     */
    /*******************************************************************/

    public void insert(Car car);
   
    /*******************************************************************/
    /*                         Update Method                           */
    /* =============================================================== */
    /* update() - uses a update statement to change a record in the    */
    /*            in the CarsRUs database from the Cars table.         */
    /*            Returns nothing.                                     */
    /*******************************************************************/

    public void update(Car car);

    /*******************************************************************/
    /*                         Delete Method                           */
    /* =============================================================== */
    /* delete() - uses a delete statement to remove a record in the    */
    /*            in the CarsRUs database from the Cars table.         */
    /*            Returns nothing.                                     */
    /*******************************************************************/

    public void delete(Car car);
}

Cars R US My SQL Database Tables

CarRUs.sql

create table Cars
(
    id MEDIUMINT NOT NULL AUTO_INCREMENT,
    VinNumber varchar(17),
    TrimLevel varchar(3),
    Model varchar(20),
    Make varchar(20),
    PreviewImage varchar(500),
    Description varchar(1000),
    Price varchar(20),
    PRIMARY KEY (id)
);

create table Users
(
    id MEDIUMINT NOT NULL AUTO_INCREMENT,
    Username varchar(20),
    Password varchar(20),
    PermissionLevel int,
    PRIMARY KEY (id)
);

INSERT INTO Users(Username, Password, PermissionLevel) VALUES ("Nate", "password", 0);
INSERT INTO Users(Username, Password, PermissionLevel) VALUES ("Billy", "password", 1);
INSERT INTO Users(Username, Password, PermissionLevel) VALUES ("Jill", "password", 1);
INSERT INTO Users(Username, Password, PermissionLevel) VALUES ("Zach", "password", 1);

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Primera", "Nissan", "The Nissan Primera was produced between 2002 and 2008. It was available as a 4-door sedan or a 5-door hatchback or estate. The entry-level 1.6-liter petrol feels underpowered for a large car. The 1.8-liter petrol is keen, the refined 2.0-liter unit is the star performer. An improved 2.2-liter turbodiesel performs well, but is only relatively economical, as it's competitors in this class with similar characteristics offer even lower fuel consumption.", "img/car1.png", "$ 23,320.00", "f323f2fl8h48h384h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Cefiro", "Nissan", "The Nissan Cefiro is an intermediate-size automobile range sold in Japan and other countries. It was available only as a 4 door sedan. A large proportion were equipped with automatic transmissions. Originally marketed towards the Japanese salaryman the top model used the same engine as found in the R32 Nissan Skyline, a 2 litre turbo charged 6 cylinder engine capable of just over 200 hp (150 kW). Other variants came with other versions of the Nissan RB engine. Brand new, the Cefiro was slightly more expensive than the equivalent Nissan Skyline.", "img/car2.png", "$ 38,165.00", "e323j2ff8a4dh384h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Camry", "Toyota", "The Toyota Camry is a midsize car manufactured by Toyota in Georgetown, Kentucky, USA; as well as Australia; and Japan. Since 2001 it has been the top selling car in the United States.The Holden equivalents were not successful even though they came from the same factory as the Camry. Since 2000 Daihatsu has sold a Camry twin named the Daihatsu Altis. The name comes from the English phonetic of the Japanese word \"kan-muri,\" which means \"crown.\"", "img/car3.png", "$ 24,170.00", "s323h2es8h4gh3d4h", "asd");
   
INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Century", "Toyota", "The Toyota Century is a large four-door limousine produced by Toyota mainly for the Japanese market. Production of the Century began in 1967 and the model received only minor changes until redesign in 1997. This second-generation Century is still sold in Japan. The Century is produced in limited numbers and is built in a \"nearly hand-made\" fashion. It is often used by royalty, government leaders, and executive businessmen. Although the Century is not exported outside Japan in large numbers, it is used frequently by officials stationed in overseas Japanese offices. In contrast to other luxurious cars (such as the Maybach or a Rolls Royce), the Century has not been positioned and marketed as a sign of wealth or excess. Instead, the Century projects an image of conservative achievement.", "img/car4.png", "$ 28,730.00", "a323d2fs8hh8k3i4h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Sigma", "Mitsubishi", "The third-generation of Japanese car Mitsubishi Galant, dating from 1976, was divided into two models: the Galant Sigma (for the sedan and wagon) and the Galant Lambda (the coupe). The former was sold in many markets as the Mitsubishi Galant (without the word 'Sigma') and in Australia as the Chrysler Sigma (until 1980, after which it became the Mitsubishi Sigma). Strangely, in New Zealand it was badged as 'Galant Sigma' but colloquially referred to as the 'Sigma', a name it formally adopted after 1980.", "img/car5.png", "$ 54,120.00", "i3d3fsfd8hf8f384h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Challenger", "Mitsubishi", "The Mitsubishi Challenger, called Mitsubishi Pajero Sport in most export markets, Mitsubishi Montero Sport in Spanish-speaking countries (including North America), Mitsubishi Shogun Sport in the UK and Mitsubishi Nativa in Central and South Americas (the Challenger name was also used in Australia), is a medium sized SUV built by the Mitsubishi Motors Corporation. It was released in 1997, and is still built as of 2006, although it's no longer available in its native Japan since the end of 2003.", "img/car6.png", "$ 58,750.00", "z32xfvfb8hn8hb84h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Civic", "Honda", "The eighth generation Honda Civic is produced since 2006. It is available as a coupe, hatchback and sedan. Models produced for the North American market have a different styling. At the moment there are four petrol engines and one diesel developed for this car. The 1.4-liter petrol is more suitable for the settled driving around town. The 1.8-liter petrol, developing 140 hp is a willing performer. The 2.2-liter diesel is similar to the Accord's unit. It accelerates rapidly and is economical as well. The Honda Civic is also available with a hybrid engine. In this case engine is coupled with an automatic transmission only. The 2.0-liter model is available with the paddle shift gearbox.", "img/car1.png", "$ 17,479.00", "x323d2vl8x48z384h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("New Beetle", "Volkswagen", "The Volkswagen Beetle is produced since 1998. It is available as a coupe or convertible. The VW Beetle is powered by a wide range of engines, including two 1.9-liter turbodiesels, and turbocharged 1.8-liter petrol. There is also a 3.2-liter RSI available for the range topper. The new Beetle has nothing in common with the rear-engined original, except the 'retro' design. It is based on the VW Golf and has the same solid build quality.", "img/car2.png", "$ 67,540.00", "t323fyfy8e48i3y4h", "asd");
                       
INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Golf V", "Volkswagen", "The Volkswagen Golf V is produced since 2003. There is a wide range of fine and reliable engines. The best choice would be 1.6-liter FSI direct injection petrol with 115 hp or 2.0-liter turbodiesel with 150 hp. The last mentioned features an outstanding fuel economy for it's capacity and acceleration speed, although is a bit noisy. The strongest performer is a 2.0-liter GTI, delivering 200 hp, which continues the Golf's hot hatch traditions. Steering is sharp. The car is stable at speed and easily controlled as the power steering gets weightier with speed, unfortunately it does not give enough feedback to the driver. The ride is a bit firm in town, as the reliability of suspension was preferred to the comfort. It is a common feature of all VW Golf's.", "img/car3.png", "$ 78,200.00", "y323u2fo8hp8g3l4h", "asd");

INSERT INTO Cars(Model, Make, Description, PreviewImage, Price, VinNumber, TrimLevel) VALUES("Neon", "Chrysler", "This car is sold as the Dodge Neon in the United States and as Chrysler Neon for export only. It is a second generation Neon produced since 2000. There is a choice of three petrol engines. The basic 1.6-liter petrol is the same unit found on the MINI. The top of the range is a 2.0-liter engine, providing 133 hp, besides acceleration is a weak point of all Neons.", "img/car4.png", "$ 85,400.00", "q323w2bl8v48s384a", "asd");

No comments:

Post a Comment