CS 202辅导、讲解html/css编程、辅导CS/OS程序、讲解CS/OS设计
2018-10-09
Programming Assignment #1CS 202 Programming Systems*** Make sure to read the Background Information first!It applies to all programming assignments this term***Always backup your files PRIOR to using tarDouble check that the arguments specified with for tar are correct!Penalties will apply to all submissions incorrectly archived/uploadedBackground:When beginning with this project, the first thing to keep in mind is that we are no longer workingon CS163 programs! In CS163 we were concerned about creating Abstract Data Types and the classconstruct facilitated this. Instead, this term we will be focusing on how to create Object OrientedSolutions. An ADT may be part of that solution – but it certainly shouldn’t be the primary focus.Instead you want to strive for classes to have specific “jobs” and have classes derived from moregeneral classes, whenever appropriate. We will be working in situations where there are multipleclasses, so you will want to focus on dividing the design into smaller components that have specificjobs working together to solve the problem.Every assignment this term needs to have at least 5 classes. With these, think about how to designthe classes such that they reduce the amount of work another class needs to do. The idea is if wehave “robot” like classes doing the smaller tasks or “jobs”, that by the time we get to a larger classthat has more to manage – it will have little left to do! We can achieve this by delegating. Often theover-use of “getters” can cause the opposite to happen – and instead of delegating the managingclass has to fundamentally do all of the work itself.Overview of a Concept:The future of driving is here with the latest in hands-free self driving cars. It is hard to imagine, butthe industry is heading this way. In early prototypes, there were issues of cars not detecting thewhite-lines when there was rain or fog. Other issues came up with the detection of pedestrians.There is plenty of buzz out there about the need for standardize software for the vehicles to “talk toone another” to avoid crashes. From a software perspective, there is so much that needs to beconsidered. In industry software this includes many aspects of computer science from datastructures for the mapping and image collection and artificial intelligence to train the computers todetect lane lines, cyclists, etc. Most of which is beyond the scope of CS202! However, we can beginto think about the problem from a data structures perspective to learn how to manage theinformation flow that would be needed if vehicles were in fact communicating with each other.Lecture #2 will cover the concepts of building an object oriented program!CS202 Fall 2018 Programming Assignment #1Specifics about Program #1 **WAIT TO BEGIN UNTIL LECTURE #2 **For Program #1, you will be creating an object oriented program that will simulate the movementof a car along a one way street in Portland (e.g., 4th avenue). Your program will need to support thefollowing characteristics:1. Number of lanesa. Speed limitb. Ability to change lanesc. If lanes are reserved for busses2. Adjacent Carsa. How much space is acceptableb. Do we need to make maneuvers based on an adjacent car coming too closec. Does the driver need to take over?Then, select ONE other characteristic to consider in your movement (e.g., stop lights, cross walks,bike lanes, or others). Here are just a few thoughts about your choice – this is not a comprehensivelist and you may find you would like to add some other feature (please contact your Instructor):1. Stop Lightsa. Where they are locatedb. Our distance to themc. Amount of braking time needed based on our speed2. Cross walksa. Where they are locatedb. Do we need to stop for anyone?c. Amount of braking time needed based on our speed3. Bike lanesa. Where they are locatedb. How much space is acceptablec. Do we need to make maneuvers based on an adjacent car coming too closed. Does the driver need to take over?4. Pedestrians and bikes not on cross walks or bike lanes!a. Do we need to stop for anyone?b. Amount of braking time needed based on our speedc. Do we need to make maneuvers based on an adjacent car coming too closed. Does the driver need to take over?Once you make a decision about what aspect you want to support - you will want to think aboutbreaking this down into a series of classes and create them independent of the entire problem. Somerelationships should be hierarchical, others can be containment. With hierarchies always push thecommon elements up to the base class. Avoid classes with only setters and getters! And Nodes willneed to be classes instead of structs. CS202 Fall 2018 Programming Assignment #1Required Data structuresThis program should implement the following data structures:1. A Map implemented as an array of linear linked lists for the lanes.a. All traversal functions must be implemented recursively.b. Each element of the array should represent a lane on the one way streetc. Each head pointer points to a LLL of vehicles in the lane.2. Implement another data structure (of your choice) that represents the path that your vehicleis taking with pointers to the vehicles in adjacent lanes (for quicker access).a. Use recursion for your traversal algorithms!Types of Operations to SupportOnce we have the data available for the lanes and vehicles in a lane1. The user should select if their vehicle should go forward or stop2. Communicate to the user about the location of their vehicle as it progresses3. Inform the user if the driver needs to take back control of the vehicle4. Issue warnings if there isn’t enough space between vehicles (bikes or pedestrians)Brainstorming (The following are suggestions)The following represents some ideas on the design – the first step is to plan what classes mightmake the most sense! Some of the basics that are part of an OO program could be:1. Mapa. Contains the lanes and vehicles in each laneb. Contains the crosswalks and/or bike lanesc. Allows a car to move through the map (stop, go, change lanes)2. Cara. A car is at a particular location, is traveling at a given speed, and has knowledge ofhow long it takes to brake at a given speed (consider if a car should be derived fromits location!)b. A car can provide information about the proximity to another based on its locationc. A car can provide information about whether it is moving or stationary (e.g., parked)3. Crosswalka. A crosswalk is also at a particular location.b. It can indicate if there someone (person, scooter, bike, etc.) on the crosswalk (sothat your car will need to stop)Anything that is similar between these or other classes that you write should be pushed up to bepart of a base class. For example, classes that manage collections of items may be derived from acommon base class that manages the collection. Keep classes small and functions small. A largeclass or function means that the problem has not yet been broken down into its basic components(objects).