Skip to content

Chloe23077/AT3ProjoctV2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AT3ProjoctV2

first update carpark project

AT3P1

Identify classes, methods, and attributes

Class Name Attributes Methods
Carpark name, init
lacation, update_temperature
max_bays, publicsh_car_status
occupied, add_car
displays, remove_car
bays, is_full
cars register_display
Sensor car_park init
_read_plate
detect
update_car_park
Display temperature, init
available_bays, display_board
show_full,
banner
Config file_name init
config
`test_carpark' self.car_park test_carpark_is_instantiated
test_display_is_instantiated
test_sensor_is_instantiated
setUp

AT3P2

AT3P3

Q. Which class is responsible for the number of available bays (and why)?

I think the class resopnsible for the number of available bays is the carpark class.
This is because I think it tracks the current status in the carpark and manages the available bays.

Q. Which class is responsible for the current temperature (and why)?

I think the class responsible for the number of available bays is the carpark class.
This is because I think is tracks the current status in the carpark and manages the available bays.

Q. Which class is responsible for the time (and why)?

Like temperature, I think the carpark class manages time. This is because Carpark thinks that the display is updateed and the display class
receives and displays the updated information.

1. What is the difference between an attribute and a property?

Properties: A characteristic or characteristic of an object. Regarding this project, for example, assuming that there is a car class, it can be the color and model for it.
Property: Among the above attributes, it can be said to be an external accessible attribute. You can read or write values of methods and perform additional actions when accessing properties.

2. Why do you think we used a dictionary to hold the data we passed the display? List at least one advantage and one disadvantage of this approach.

I think I chose it because I can easily access the value through a specific key.
Advantage: It is useful for processing various types of data because it stores data in the form of key-value.
Disadvantages: When the code becomes complicated, it can be difficult to figure out what data is stored at a glance.

AT3P4

AT3P5

AT3P6

image

Test the car park register method

The car park register method should accept a Sensor or Display object. It should raise a TypeError if the object is neither a Sensor nor a Display. Before proceeding, think about where you would test this behaviour. Should you test it in the CarPark unit tests or the Sensor unit tests? Why?

Registering the objects (sensors and displays) in the CarPark class and updating their status seems more appropriate within the context of the CarPark class. This is because the sensors detect the entry and exit of vehicles, notifying the CarPark, which, in turn, updates the displays. Given this flow of interaction, the responsibility for registering and updating lies with the CarPark. Therefore, testing these actions in the unit tests for the CarPark class is deemed suitable.

AT3P7

AT3P8

AT3P9

AT3P10

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages