Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
0aa3ccf
Add files via upload
ojgao Feb 4, 2020
556c7e4
Node_Week1
KathyLiu20 Feb 5, 2020
67c9209
Add files via upload
ryansxl Feb 5, 2020
35c337b
Merge pull request #292 from bitprj/master
kavuong Feb 7, 2020
945a296
learnyouhtml 2nd half!
sihuacai Feb 8, 2020
8ce431a
Merge pull request #301 from bitprj/SarahC
jhvoong Feb 8, 2020
2f35034
Merge pull request #261 from ryansxl/ryan
jhvoong Feb 8, 2020
c0d8dce
Merge pull request #259 from bitprj/Kathy
jhvoong Feb 8, 2020
ddc889d
Create Lab2
ryansxl Feb 9, 2020
87d150d
Add files via upload
ryansxl Feb 9, 2020
9dacb9c
Add files via upload
ryansxl Feb 9, 2020
0e1f723
Delete Lab2
ryansxl Feb 9, 2020
51626d2
Delete 1.md
ryansxl Feb 9, 2020
fb2c4fb
Delete 11.md
ryansxl Feb 9, 2020
ade53d1
Delete 111.md
ryansxl Feb 9, 2020
59dadb7
Delete 12.md
ryansxl Feb 9, 2020
ee1067f
Delete 121.md
ryansxl Feb 9, 2020
da54b10
Delete 2.md
ryansxl Feb 9, 2020
968c4b0
Delete 21.md
ryansxl Feb 9, 2020
826eb15
Delete 211.md
ryansxl Feb 9, 2020
1439a3c
Delete 3.md
ryansxl Feb 9, 2020
52b1b19
Delete 31.md
ryansxl Feb 9, 2020
710a798
Delete 311.md
ryansxl Feb 9, 2020
393b6de
Delete 4.md
ryansxl Feb 9, 2020
0e887dd
Delete 41.md
ryansxl Feb 9, 2020
f9366c9
Delete 411.md
ryansxl Feb 9, 2020
0a94661
Delete 5.md
ryansxl Feb 9, 2020
534d4c8
Delete 51.md
ryansxl Feb 9, 2020
de79e68
Delete 511.md
ryansxl Feb 9, 2020
d684abd
Week 1 Labs
kavuong Feb 13, 2020
6461d50
Week 2 Labs
kavuong Feb 13, 2020
3d2d379
Week 3 Labs
kavuong Feb 13, 2020
052eb7c
Week 2 Modifications
kavuong Feb 13, 2020
3a2e147
Merge branch 'master' into SarahC
sihuacai Feb 15, 2020
1816f14
forms tags ul concept cards
sihuacai Feb 15, 2020
aded528
closes issues 314, 317
sihuacai Feb 15, 2020
2049868
commit here
ojgao Feb 19, 2020
e3a912d
Merge branch 'Owen' into Owen_Express_Part1
ojgao Feb 19, 2020
a8da4fc
Merge pull request #464 from bitprj/Owen_Express_Part1
ojgao Feb 19, 2020
b95ca27
add
ojgao Feb 20, 2020
f0353e9
postman act 2
sihuacai Feb 20, 2020
d31ffb5
minor edits to Lab 3.1
kavuong Feb 20, 2020
d7ecc9c
Create ReadMe.md
ojgao Feb 20, 2020
f086028
Revert "Create ReadMe.md"
ojgao Feb 20, 2020
4bb99b2
Revert "Revert "Create ReadMe.md""
ojgao Feb 20, 2020
a407acd
Update Cards
ojgao Feb 20, 2020
9d67db9
Remove Postman
ojgao Feb 21, 2020
301d498
Remove Postman
ojgao Feb 21, 2020
c90c567
Merge pull request #523 from bitprj/Twitter_Labs
KathyLiu20 Feb 22, 2020
9126b58
Merge branch 'Twitter_Labs' of https://github.com/bitprj/curriculum i…
jhvoong Feb 22, 2020
aefd651
a
jhvoong Feb 22, 2020
a4a1bcb
Create 121
ryansxl Feb 23, 2020
4e28e71
Add files via upload
ryansxl Feb 23, 2020
0f1991b
Delete 121
ryansxl Feb 23, 2020
1a28866
Add files via upload
ryansxl Feb 23, 2020
f56ac83
Delete 截屏2020-02-21下午10.09.55.png
ryansxl Feb 23, 2020
e80970c
Delete 111.md
ryansxl Feb 23, 2020
9457df6
Add files via upload
ryansxl Feb 23, 2020
c5d4506
Merge pull request #543 from bitprj/John
ojgao Feb 23, 2020
fe38f1e
Delete 1.md
ryansxl Feb 24, 2020
e624672
Delete 111.md
ryansxl Feb 24, 2020
667a5ce
Delete 112.md
ryansxl Feb 24, 2020
36f83f1
Delete 12.md
ryansxl Feb 24, 2020
18a157f
Delete 121.md
ryansxl Feb 24, 2020
c4b8559
Delete 122.md
ryansxl Feb 24, 2020
c2a24b0
Delete 123.md
ryansxl Feb 24, 2020
ed55810
Delete 2.md
ryansxl Feb 24, 2020
53c80c2
Delete 21.md
ryansxl Feb 24, 2020
83c92ca
Delete 22.md
ryansxl Feb 24, 2020
857521b
Delete 221.md
ryansxl Feb 24, 2020
bbf155c
Delete 222.md
ryansxl Feb 24, 2020
a5483e4
Delete 3.md
ryansxl Feb 24, 2020
94fba81
Delete 311.md
ryansxl Feb 24, 2020
8231945
Delete 312.md
ryansxl Feb 24, 2020
2f54192
Delete 313.md
ryansxl Feb 24, 2020
299bb2e
Delete 32.md
ryansxl Feb 24, 2020
d1de27b
Delete 33.md
ryansxl Feb 24, 2020
e2530ea
Delete 331.md
ryansxl Feb 24, 2020
70f64a4
Delete 332.md
ryansxl Feb 24, 2020
ec6bed9
Delete 333.md
ryansxl Feb 24, 2020
c1fb303
Delete 4.md
ryansxl Feb 24, 2020
1522e86
Delete 5.md
ryansxl Feb 24, 2020
b4ced14
Delete 51.md
ryansxl Feb 24, 2020
9948ee6
Delete 52.md
ryansxl Feb 24, 2020
0980f89
Add files via upload
ryansxl Feb 24, 2020
2a6096e
Merge pull request #587 from bitprj/Twitter_Labs
sihuacai Feb 24, 2020
cbc21ae
Merge branch 'SarahC' of https://github.com/bitprj/curriculum into Sa…
sihuacai Feb 24, 2020
2229b9a
fixing issues
sihuacai Feb 24, 2020
a4062dd
Merge branch 'master' into Twitter_Labs
kavuong Feb 24, 2020
f06e0de
Update Twitter Lab 2.2
ojgao Feb 24, 2020
c31d213
Remove Postman and Node Week 1
ojgao Feb 24, 2020
89efe9c
Delete .DS_Store
ojgao Feb 24, 2020
1299187
Delete .DS_Store
ojgao Feb 24, 2020
d1e45cd
Delete .DS_Store
ojgao Feb 24, 2020
8a05811
Delete 5.md
ojgao Feb 24, 2020
1dc7f48
Update Twitter Lab 1.1
ojgao Feb 24, 2020
37335ba
twitter_lab_1.2
KathyLiu20 Feb 24, 2020
894c052
Correct Files
ojgao Feb 25, 2020
0d69bb7
Merge branch 'Owen' into Kathy
ojgao Feb 25, 2020
70a6df4
Merge pull request #596 from bitprj/Kathy
ojgao Feb 25, 2020
43a982f
Merge branch 'master' into Owen
ojgao Feb 26, 2020
3a6fceb
Twitter week 2/18
nskong Feb 26, 2020
0263dbd
Readded code of conduct, license, readme
nskong Feb 26, 2020
3770e3c
Merge branch 'Twitter_Labs' into Nathaniel-twitter
nskong Feb 26, 2020
2645519
Twitter week 2/18
nskong Feb 26, 2020
fd5c72b
Readded code of conduct, license, readme
nskong Feb 26, 2020
83e2898
Week 1 Labs
kavuong Feb 13, 2020
a6d0b79
Week 2 Labs
kavuong Feb 13, 2020
0a6be7a
Week 3 Labs
kavuong Feb 13, 2020
c386e3f
Week 2 Modifications
kavuong Feb 13, 2020
a36b0c5
minor edits to Lab 3.1
kavuong Feb 20, 2020
de2902a
Merge branch 'twitter_labs' into owen
kavuong Feb 29, 2020
c8d5c0f
Merge branch 'master' into Twitter_Labs
kavuong Feb 29, 2020
0b03e92
Delete .DS_Store
kavuong Feb 29, 2020
c677cb8
Merge pull request #597 from bitprj/Owen
kavuong Feb 29, 2020
cb24d87
Merge branch 'master' into Twitter_Labs
kavuong Feb 29, 2020
d625a05
Update 1.md
kavuong Feb 29, 2020
0c7bfaa
revert labs
kavuong Feb 29, 2020
fdb3cff
Merge branch 'Twitter_Labs' of https://github.com/bitprj/curriculum i…
kavuong Feb 29, 2020
332f8d2
Updated 4.md, 41.md, 42.md, 123.md, 211.md, 212.md, 213.md, Added REA…
nskong Mar 2, 2020
e26b11e
Merge branch 'master' of https://github.com/bitprj/curriculum into Na…
nskong Mar 2, 2020
0535237
Merge branch 'master' into Twitter_Labs
kavuong Mar 3, 2020
89c6104
Twitter Lab 3.1 and 3.2 updates from Nathan
nskong Mar 5, 2020
a826074
fixed merge conflicts
nskong Mar 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Activity/Lab Issue Template
about: For raising issues on all activities and labs
title: "[Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: ''
assignees: ''

---

#### _(insert card heading here - ex. '1.md')_
* _(insert feedback)_
#### _(insert card heading here - ex. '2.md')_
* (insert feedback)_
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Activity/Lab Issue Template
about: For raising issues on all activities and labs
title: "[Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: ''
assignees: ''

---

#### _(insert card heading here - ex. '1.md')_
* _(insert feedback)_
#### _(insert card heading here - ex. '2.md')_
* (insert feedback)_
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Activity/Lab Issue Template
about: For raising issues on all activities and labs
title: "[Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: ''
assignees: ''

---

#### _(insert card heading here - ex. '1.md')_
* _(insert feedback)_
#### _(insert card heading here - ex. '2.md')_
* (insert feedback)_
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Activity/Lab Issue Template
about: For raising issues on all activities and labs
title: "[Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: ''
assignees: ''

---

#### _(insert card heading here - ex. '1.md')_
* _(insert feedback)_
#### _(insert card heading here - ex. '2.md')_
* (insert feedback)_
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/technical-writing-template 6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Technical Writing Template
about: 'For Stage 4: technical writers'
title: "[Stage 4] [Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: 'Stage 4: Final Edits'
assignees: ''

---

Technical edits needed on all of the Markdown files in this activity or lab.

@writer
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/technical-writing-template 7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Technical Writing Template
about: 'For Stage 4: technical writers'
title: "[Stage 4] [Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: 'Stage 4: Final Edits'
assignees: ''

---

Technical edits needed on all of the Markdown files in this activity or lab.

@writer
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/technical-writing-template 8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Technical Writing Template
about: 'For Stage 4: technical writers'
title: "[Stage 4] [Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: 'Stage 4: Final Edits'
assignees: ''

---

Technical edits needed on all of the Markdown files in this activity or lab.

@writer
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/technical-writing-template 9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Technical Writing Template
about: 'For Stage 4: technical writers'
title: "[Stage 4] [Activity 2.2.1] Bookkeeper: Styling, Visuals, Rearranging Cards"
labels: 'Stage 4: Final Edits'
assignees: ''

---

Technical edits needed on all of the Markdown files in this activity or lab.

@writer
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Module4_Labs/.DS_Store
Module4_Labs/Lab2_Doubly_Linked_List/.DS_Store
Module4_Labs/Lab3_File_System/.DS_Store
Expand Down
57 changes: 57 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/1 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!--title={Car Dealership}-->

<!--badges={Python:125,Software Engineering:20}-->

<!--concepts={function_decorator.mdx, class_method.mdx, difference_with_instance_variables.mdx, class_variables.mdx, using_objects.mdx, python_objects.mdx, __init__.mdx, invoke_init.mdx, Inheritance.mdx}-->

![black convertible coupe parked near high-rise building](https://images.unsplash.com/photo-1523676060187-f55189a71f5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80)



You are going to use object oriented programming (OOP) to write a program that allows the user to browse vehicles for a car dealership.

There will be various comments scattered around the script file. Those with FINISHED are to be left alone, while those with TODO are to be completed by you. `pass` is used as a placeholder so your program will not crash with the missing function definitions.



**Base class** &rarr; Vehicle

**Inherited classes** &rarr; Car, Truck, Motorcycle

(These classes inherit from Vehicle)



The program will read in the information from a CSV file and store it into a **list** as either a Car, Truck, or Motorcycle.

The user will be able to print out all the vehicles that have a specific attribute (Example: all Toyota makes, vehicles built in 1998, etc.).

All attributes:

* **make**
* **model**
* **year**
* **mileage**

In addition, you will have to complete the class definitions before you can use them.

One is an **instance method** `final_sale_price` that calculates the final sale price of each vehicle based on:

1. The class' `base_sale_price`
2. The class' `rate`
3. Each instance's `mileage`



First, complete the class definitions. This include all the comments with TODO in them.



**ABC Package:**

Some of your classes will be abstract classes, which are classes that contain one or more abstract methods. Abstract methods have no implementation, but are declared inside the class. Python's **ABC** (Abstract Base Class) package will be useful for this assignment. To import this package use:

```Python
from abc import ABCMeta, abstractclass
```

7 changes: 7 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/11 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--title={vehicle_type()}-->

<!--badges={Python:18,Software Engineering:3}-->

<!--concepts={abstract_classes.mdx}-->

Notice that all the inherited classes (Car and Motorcycle) both have vehicle_type() definitions to them. That means that vehicle_type is an **abstract class**, and you should make it so.
24 changes: 24 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/111 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--title={vehicle_type()}-->

<!--badges={Python:37,Software Engineering: 6}-->

<!--concepts={abstract_classes.mdx}-->

To make a class function abstract, you need to import the abstractmethod function from the abc package.

```python
from abc import ABCMeta, abstractclass
```



Then add the decorator @abstractclass immediately above the function. Decorators allow us to alter functions or classes. They wrap a function or class and add functionality without having to actually alter the function or class. Notice how we use the @abstractmethod decorator above the `vehicle_type()` function to allow it to function as an abstract method.

```python
@abstractmethod
def vehicle_type():
"""Return a string of "Car", "Truck", or "Motorcycle" """
pass
```

Now this function will call the appropriate inherited class' `vehicle_type()`
1 change: 1 addition & 0 deletions Module3_Labs/Lab2_CarDealershipLab/111.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ def vehicle_type():
pass
```


Now this function will call the appropriate inherited class' `vehicle_type()`
13 changes: 13 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/12 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--title={final_sale_price()}-->

<!--badges={Python:18,Software Engineering: 3}-->

<!-- concepts={Instance Variable vs. Class Variable, Class Variable} -->

We have to understand which data comes from the class, and which come from instances of that class.

`base_sale_price` is a class variable

`rate` is a class variable

`mileage` is an instance variable
28 changes: 28 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/121 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--title={final_sale_price()}-->

<!--badges={Python:37,Software Engineering:6}-->

<!--concepts={Instance Variable vs. Class Variable, Class Variable}-->

To use a class variable, type the class, a dot, then the class' variable name.

To use an instance variable, type self, a dot, then the instance's variable name.



`base_sale_price` is a class variable

`rate` is a class variable

`mileage` is an instance variable



Here is `final_sale_price()` for the Car method.

```python
def final_sale_price(self):
return Car.base_sale_price - (int(self.mileage) * Car.rate)
```

Truck and Motorcyle are the same, except replace "Car" with either "Truck" or "Motorcycle".
7 changes: 7 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/2 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--title={read()}-->

<!--badges={Python:150,Software Engineering:30}-->

<!--concepts={ParsingCSVFiles.mdx}-->

Parse the csv file `vehicles.csv` and store the data into instances of a class. Store these instances into a **list** and return them.
7 changes: 7 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/21 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--title={read()}-->

<!--badges={Python:45,Software Engineering:90}-->

<!-- concepts={Creating an Instance} -->

Depending on which type of vehicle it is, you need to either call Car(), Truck(), or Motorcycle(). You can tell which one to call based on the first element of each row in the csv file.
58 changes: 58 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/211 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!--title={read()}-->

<!--badges={Python:90,Software Engineering:18}-->

<!-- concepts={Creating an Instance} -->

First, you have to open the file as a CSV file (the CSV package is already imported) and use `next()` once read past the title row.

```python
with open(filename) as csvfile:
csv_reader = csv.reader(csvfile)
titles = next(csv_reader)
vehicles = []
```
Still under the `with`...`as` statement, iterate through each of the remaining rows of the csv_reader and store the data each into a variable with a reasonable name

```python
for row in csv_reader:
vehicle_type, make, model = tuple(row[:3])
year, mileage = tuple(row[3:])
```

Now you have check which class to create an instance from. I stored the first column data into `vehicle_type` and that can be used to determine if it's a Car, Truck, or Motorcycle.

Use an **if statement** to compare for strings.

```python
if (vehicle_type == "Car"):
new_vehicle = Car(make, model, year, mileage)
elif (vehicle_type == "Truck"):
new_vehicle = Truck(make, model, year, mileage)
elif (vehicle_type == "Motorcycle"):
new_vehicle = Motorcycle(make, model, year, mileage)
vehicles.append(new_vehicle)

return vehicles
```

To make an instance, just pass in the correct arguments as defined in the class method `__init__()`

```python
if (vehicle_type == "Car"):
new_vehicle = Car(make, model, year, mileage)
elif (vehicle_type == "Truck"):
new_vehicle = Truck(make, model, year, mileage)
elif (vehicle_type == "Motorcycle"):
new_vehicle = Motorcycle(make, model, year, mileage)

```

Don't forget to append `new_vehicle` to the return variable **vehicles** as well as return it.

```python
vehicles.append(new_vehicle)

return vehicles
```

7 changes: 7 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/3 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--title={print_unique()}-->

<!--badges={Python:100,Software Engineering:20}-->

<!--concepts={Sets.mdx, class_variables.mdx}-->

Finish writing the `print_unique()` function, which finds all the **unique** names that go under the attribute `attribute`. After you have them, print them all out sorted, then return the unique attributes. A `print_unique()` function is very helpful for a car dealer because it allows him or her to quickly access a sets of data containing all the car makes, car models, and years made in his or her lot.
10 changes: 10 additions & 0 deletions Module3_Labs/Lab2_CarDealershipLab/31 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--title={Calling Instance Variables}-->

<!--badges={Python:30,Software Engineering:6}-->

<!-- concepts={Instance Variable vs. Class Variable} -->

You are checking by which attribute to add to your group of unique attributes. In the `main()` output, there is "Make", "Model", and "Year", so you need to retrieve `make`, `model`, and `year` from each instance (stored in `vehicles`).

<img src="https://di-uploads-pod8.dealerinspire.com/boardwalkacura/uploads/2019/01/car-lot.jpg" width=500>

Loading