CS 233 Assignments
NbrWhen dueQuestions
8Wed 2015-05-13(on or before) PHP/MySQL Database Operations:

Develop an html interface for PHP to query and update a database table. Problem specifications and design constraints are listed below. For the database table created and loaded for lab 7, create the HTML/PHP file(s) to access and maintain this table. The solution is to be submitted to tom.brown at the domain tamuc.edu with email "subject" line to include our course code(233), your leoEmailName (e.g. mWidenius) and the assignment number.

User Interface: Produce an html page with a menu of user choices(named MenuyourLeoName.html). This page is to link to forms with input components for providing the data needed to query, insert, update, or delete a table row. Include labels by form components for the table key column, article/name, currency(e.g. cost) and quantity columns.

Processing: accept a key value from a form, then:

  1. query and display the table data for a table row, or
  2. insert a new table row with values for each column, or
  3. delete a single row by referencing the key, or
  4. update a single non-key column value (provide user options to choose the column) in one table row.

Design and Style Constraints:

  1. insert a comment at the top of each submitted file listing course code, your name, and lab assignment number; also insert line comments to clarify complex or unusual implementation steps;
  2. use the same table and column names and data types and lengths as specified for your designated data on our class web page;
  3. devise meaningful PHP data names, apply conventional case usage, initialize variables, and use named program constants for clarity;
  4. utilize PHP object-oriented methods for database access;
  5. have a single php script with four separate functions to query and maintain (insert, update, delete) your table. Forms may be included in the PHP script or coded as HTML page(s)).

Other Notes:

  1. Database tables assigned for lab 7 will be created on a university system to use when testing your solution. Your application will be implemented and tested to verify that a row may be inserted, a row updated, a row deleted. The query function will be used to verify results.
  2. The deliverable for this assignment is a (set of) HTML and PHP file(s) to perform the database file operations described above. If multiple files are to be submitted, place them in a "zip" file named for your leoMail username and attached to an email sent on or before Wednesday 13 May.
7Thu 2015-04-30(on or before) MySQL Administration

Create, load, update and export a database table. Complete steps to create a database, a user account, set passwords, grant access privileges, load and update the table, export your database, then send an email with the exported database attached to tom.brown (at) the domain tamuc.edu. The email "subject" line is to include our course code(233), your leoEmailName without the domain name(e.g. cDate1) and the assignment number.

Steps:
  1. Login to MySQL as the user root to work with the schema named mysql. Drop anonymous accounts, assign a password to root and other existing accounts. Create a database with the name cs233. Create a personal user with the same name as your "Leomail" username and grant all privileges on tables (to be) created for the cs233 database and accessed on the local host. Assign a strong password of your choice. Exit MySQL.
  2. Login to MySQL using your personal username and password given in step 1 and give the command to use the cs233 database.
  3. Create your designated table with a primary key constraint. Use the table and column names from here: http://faculty.tamu-commerce.edu/tombrown/doc233.html note: use type char(length) for the "string" items
  4. Issue a show create table statement to verify your table was created as intended.
  5. Use the dataload utility to insert data rows into your table. The data may be found here: http://faculty.tamu-commerce.edu/tombrown/data233csv.html . To verify the table was loaded correctly, enter a select statement to project all columns from all rows in primary key order.
  6. Modify your table:
    a. Delete the last table row;
    b. Insert a new row with key value greater than any row in the table.
    c. Update the first row changing the name(description) to all uppercase characters;
    * To verify the table was updated correctly, enter a select statement to list the rows in primary key order. Exit MySQL.
  7. Backup(export): invoke the mysqldump program to copy your cs233 database to a file (e.g. on a Windows device e):
    a. Change to the directory (folder) with the mysqldump utility.
    For example: cd e:\xampp\mysql\bin
    b. Execute the mysqldump program. For example:
    e:\xampp\mysql\bin> mysqldump -u userName -p cs233 > e:\yourLeoUsername.sql
  8. To document your efforts, attach the exported text file to an email to tom.brown at the domain tamuc.edu.
  9. Note: Class exercises and program examples apply to this assignment. Textbook chapters 8, 9, 10 and the appendix provide additional background.
6Thu 2015-04-16(on or before)
    Object-oriented Programming:
  • Write a PHP program to define and implement a class for data from your designated "csv" data file. Store input data items as an array of objects, sort the array, then retrieve and output the objects for a report. Submit the class (<yourDatafileNameClass>.php)and application files (<yourDatafileNameApp>.php) as attachments to an email to tom.brown at the domain tamuc.edu .
  • Class Definition:
    1. Declare private data members for the name and and decimal amount in your data. [Do not include other input items.]
    2. Define a public constructor with parameters for name and amount to be used to initialize corresponding private member variables;
    3. Create accessor(getter) and mutator(setter) functions for the two member variables;
    4. Store this class as a separate file in the same folder as your data and test application.
  • Application:
    1. "Include" the class.
    2. Define local variables corresponding to the member variables, and an array to store the set of objects created from input.
    3. Code and call a function to create an array of objects:
        a. input and assign values to local variables for name and amount;
        b. instantiate an object with properties name and amount corresponding to member variables;
        c. store each object as an array component (element);
    4. Create and call a function to implement a sort that orders the array components by name.
    5. A report function is to be defined and invoked to print a title, column heading, and detail lines. Prepare a repetition structure to retrieve, format and print detail lines with data from the array of objects.
  • Style and Design Constraints
    1. Insert a comment at the top of the class and application files with the file name, your name, the course code, and the lab number.
    2. Make descriptive identifiers, apply conventional case usage, and initialize variables. Indent and align statements for readability.
    3. Create one file for the class, and another file for the application with its main and subordinate function(s).
  • Notes:
    1. A link to the data files: http://faculty.tamuc.edu/tombrown/data233csv.html
    2. Class exercises and programming examples apply to this assignment. Textbook chapters 3, 5 and 6 provide additional background.