Survey of Programming Languages

Question 1 – C Structures and Arrays

Using your knowledge gained in the C language, develop a structure declaration (see template below) that will model the attributes you see on your

drivers license. You do not have to populate it with actual information, just provide a set of structures that could be use to model and capture the driver

license data. Think of what type each member of the structure should be, for example

int (whole numbers)

float (floating point)

double (floating point with many decimal places)

char (single character)

char name[x] (character string … x is the size, name is variable, what is a worst case size to handle your information on anyone?)

struct name (a structure with one or more members)

You will probably note that many of your members in the struct license item will probably be structures themselves. Look at each item on your license

and think if there is a group of data that belongs together. For example, when I see DOB on my license, its contains a date value that has month, day, and

year. You will also see other things, for example, license number, that probably make more sense just being a simple member that is itself not a structure

type.

Do research your home state’s driver’s license on their web sites if you are unsure of particular fields and usage. I know each state’s drivers license has

its own unique qualities, but most have have basically the same information.

/* add structures */

#define SIZE 5

/* add supporting structures */

struct date

{

int month;

int day;

int year;

};

/* add other supporting structures */

/* the actual license structure that will contain all needed members */

struct license

{

char number [25]; /* alpha numeric license number – combo of letters and numbers, 25 should be enough */

struct date birthDate; /* the date the driver was born, note that its a structure member within the license structure */

/* add other members – some will be structure types, */

/* others will be one of the types mentioned above */

};

/* declare an array of SIZE number of drivers */

struct license drivers [SIZE];

Question 2 – HTML

Take the information you modeled in question 1 and create an HTML form that has all the field information needed to submit to the registry to process

your driver’s license. Reference and start with the HTML template provided. Make your form easy to work with so it could be used in the future as an

entry form to add information about driver’s licenses.

Question 3 – JavaScript

In Question 2, you created an HTML form. Add JavaScript code to provide validation to those form fields you feel would benefit from having error

checking. The template referenced in question 2 provides a few examples on how this is done, just expand upon it. It will contain a button that can be

clicked to start the JavaScript form validation process.

Question 4 – XML

Create an XML file with sample data for 5 drivers based on your answer to question 1. Rather than using real information, make up information about

our 5 employees in our HTML assignment (i.e., Frank Fortran, Mary APL, Anton Pascal, …). Make your design flexible.

Question 5 – C++ Overloading

Write 2 function declarations (prototypes) that overload a function named “myFunction”. One receives nothing and one receives an integer. Both

declarations formally specify the function returns nothing.

Note: This is something you can do in C++ but not C. You don’t need to write the function, just declare it as a prototype.

Question 6 – C++ Classes

Write a C++ class called license. Make sure it has the data items you specified for the C version you created in Question 1 and that the items are

initialized through parameters passed to the class constructor. You will need to write the class declaration and a class constructor. Also, please write at

least 5 “getter” functions to get access to specific private data items.

Note: Instead of char [ x ] for a character array that one uses in C, use the “string” type. See the C++ lecture notes for great examples as we created

Order from us and get better grades. We are the service you have been looking for.