联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> OS作业OS作业

日期:2018-10-09 10:01

Programming Assignment #1

CS 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 tar

Double check that the arguments specified with for tar are correct!

Penalties will apply to all submissions incorrectly archived/uploaded

Background:

When beginning with this project, the first thing to keep in mind is that we are no longer working

on CS163 programs! In CS163 we were concerned about creating Abstract Data Types and the class

construct facilitated this. Instead, this term we will be focusing on how to create Object Oriented

Solutions. 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 more

general classes, whenever appropriate. We will be working in situations where there are multiple

classes, so you will want to focus on dividing the design into smaller components that have specific

jobs working together to solve the problem.

Every assignment this term needs to have at least 5 classes. With these, think about how to design

the classes such that they reduce the amount of work another class needs to do. The idea is if we

have “robot” like classes doing the smaller tasks or “jobs”, that by the time we get to a larger class

that has more to manage – it will have little left to do! We can achieve this by delegating. Often the

over-use of “getters” can cause the opposite to happen – and instead of delegating the managing

class 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, but

the industry is heading this way. In early prototypes, there were issues of cars not detecting the

white-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 to

one another” to avoid crashes. From a software perspective, there is so much that needs to be

considered. In industry software this includes many aspects of computer science from data

structures for the mapping and image collection and artificial intelligence to train the computers to

detect lane lines, cyclists, etc. Most of which is beyond the scope of CS202! However, we can begin

to think about the problem from a data structures perspective to learn how to manage the

information 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 #1

Specifics about Program #1 **WAIT TO BEGIN UNTIL LECTURE #2 **

For Program #1, you will be creating an object oriented program that will simulate the movement

of a car along a one way street in Portland (e.g., 4th avenue). Your program will need to support the

following characteristics:

1. Number of lanes

a. Speed limit

b. Ability to change lanes

c. If lanes are reserved for busses

2. Adjacent Cars

a. How much space is acceptable

b. Do we need to make maneuvers based on an adjacent car coming too close

c. 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 comprehensive

list and you may find you would like to add some other feature (please contact your Instructor):

1. Stop Lights

a. Where they are located

b. Our distance to them

c. Amount of braking time needed based on our speed

2. Cross walks

a. Where they are located

b. Do we need to stop for anyone?

c. Amount of braking time needed based on our speed

3. Bike lanes

a. Where they are located

b. How much space is acceptable

c. Do we need to make maneuvers based on an adjacent car coming too close

d. 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 speed

c. Do we need to make maneuvers based on an adjacent car coming too close

d. Does the driver need to take over?

Once you make a decision about what aspect you want to support - you will want to think about

breaking this down into a series of classes and create them independent of the entire problem. Some

relationships should be hierarchical, others can be containment. With hierarchies always push the

common elements up to the base class. Avoid classes with only setters and getters! And Nodes will

need to be classes instead of structs.

CS202 Fall 2018 Programming Assignment #1

Required Data structures

This 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 street

c. 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 vehicle

is taking with pointers to the vehicles in adjacent lanes (for quicker access).

a. Use recursion for your traversal algorithms!

Types of Operations to Support

Once we have the data available for the lanes and vehicles in a lane

1. The user should select if their vehicle should go forward or stop

2. Communicate to the user about the location of their vehicle as it progresses

3. Inform the user if the driver needs to take back control of the vehicle

4. 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 might

make the most sense! Some of the basics that are part of an OO program could be:

1. Map

a. Contains the lanes and vehicles in each lane

b. Contains the crosswalks and/or bike lanes

c. Allows a car to move through the map (stop, go, change lanes)

2. Car

a. A car is at a particular location, is traveling at a given speed, and has knowledge of

how long it takes to brake at a given speed (consider if a car should be derived from

its location!)

b. A car can provide information about the proximity to another based on its location

c. A car can provide information about whether it is moving or stationary (e.g., parked)

3. Crosswalk

a. A crosswalk is also at a particular location.

b. It can indicate if there someone (person, scooter, bike, etc.) on the crosswalk (so

that your car will need to stop)

Anything that is similar between these or other classes that you write should be pushed up to be

part of a base class. For example, classes that manage collections of items may be derived from a

common base class that manages the collection. Keep classes small and functions small. A large

class or function means that the problem has not yet been broken down into its basic components

(objects).


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp