ENGR 021 Fall 2014 Assignment #5
DUE: Monday, November 10, 2014 6:30 PM at Start of Class
Write a simple C++ program that asks the user for a quantity of seven-character California car license plates to be created. Then, have a void function outside of main() write the license plates, one per line, indexed (each line starting with a reference number that increments). Use capital letters and digits characters. Write output to a file, showing a run with at least 100 random plates. Make sure they are reasonably random! Sample run for only four: Welcome to the random license plate generator. How many do you want to see?: 4 Thanks. Here are your 4 plates: 1. DJ567PR 2. 45YM93E 3. LT3R112 4. W89700S Run again (y/n): n Bye!
Write a simple object-oriented C++ program that creates a class called "BOX", which can describes 3-dimensional boxes of different shapes and sizes. It includes, but is not limited to, the following members: Member Variables: (type not shown - YOU FILL IN) length // length of the box (m) width // width of the box (m) height // height of the box (m) thickness // thickness of the box material (cm) weight // weight of box (kg) color // color of the box contents // whether it contains something (yes or no) Member Functions: (type and parameter lists not shown - YOU FILL IN) set_size(__,__,__, etc.) // changes dimensions (l, w, h) get_size(__,__,__, etc.) // returns a box's dimensions calc_area(__,__,__, etc.) // calculates a box's outside area calc_volume(__,__,__, etc.) // calculates a box's volume print_report(__,__,__, etc.) // prints all known info about a box Of course, you must select the proper type for the variables and functions, and determine the appropriate function parameter lists, if any. You will also want to have constructor and destructor functions as necessary. The set_size() function should verify that the dimensions entered are positive (> 0), and asks user to re-enter if not. Thoroughly test the program with a variety of box shapes and sizes that you make up. For example, have it make a box, calculate its area and volume, then change its shape, calculate again, etc. and verify that it is working properly. Then, using the object-oriented functions, run and turn in output for the following scenario: a. Construct a box, give it a name, set length=2.5, width=5.4, height =1.9, thickness=0.25, weight=354.5, no contents. b. Calculate area and volume c. Report all info about the box namedd. Change height to 4.75. e. Calculate area and volume f. Report all info about the box named g. Construct a different box, give it a name, length=63.0, width=14.0, height =8.3, thickness=0.95, weight=430.0, has some contents inside it. h. Calculate area and volume i. Change its length to 72.0, thickness 0.66 j. Calculate area and volume k. Construct another box, give it a name and all attributes that you make up yourself. l. Report all info about the box named m. Destroy all box objects created