Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Submit HW18, add source code in some homework directories
Browse files Browse the repository at this point in the history
  • Loading branch information
hanggrian committed Apr 15, 2024
1 parent 315e896 commit 8518323
Show file tree
Hide file tree
Showing 25 changed files with 1,429 additions and 897 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Microsoft Word
~$*.docx*

# draw.io
*.drawio.bkp
Binary file modified assignments/hw12-13.docx
100755 → 100644
Binary file not shown.
64 changes: 64 additions & 0 deletions assignments/hw12-13/NuclearWasteStorage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
class NuclearWasteStorage {
int dangerLevel;
Lock lock;

void lockDoor() {
int entryCode = lock.getEntryCode();
boolean safe;
if (entryCode == lock.authorizedCode) {
int shieldStatus = Shield.getStatus();
if (shieldStatus == Shield.inPlace()) {
int radiationLevel = RadSensor.get();
if (radiationLevel < dangerLevel) {
safe = true;
} else {
safe = false;
}
} else {
safe = false;
}

if (safe) {
Door.locked = false;
Door.unlock();
} else {
Door.lock();
Door.locked = true;
}
}
}
}

class Shield {
static int inPlace() {
return 0;
}

static int getStatus() {
return 0;
}
}

class RadSensor {
static int get() {
return 0;
}
}

class Door {
static boolean locked;

static void lock() {
}

static void unlock() {
}
}

class Lock {
int authorizedCode;

int getEntryCode() {
return 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mxfile host="Electron" modified="2024-02-19T12:29:17.729Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/23.1.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="1X_2GuBqxCA-ND3Ldlzf" version="23.1.5" type="device">
<diagram name="Page-1" id="CbtIC47lDX5ox28n0rnE">
<mxfile host="Electron" modified="2024-04-15T02:06:05.959Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.2.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="sLEhm1v_a-FBVnIoFofG" version="24.2.5" type="device">
<diagram name="figure1" id="CbtIC47lDX5ox28n0rnE">
<mxGraphModel dx="1242" dy="805" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="670" pageHeight="340" math="0" shadow="0">
<root>
<mxCell id="0" />
Expand Down
Binary file modified assignments/hw14.docx
100755 → 100644
Binary file not shown.
Binary file modified assignments/hw15-16.docx
100755 → 100644
Binary file not shown.
Binary file modified assignments/hw17.docx
100755 → 100644
Binary file not shown.
Binary file modified assignments/hw18.docx
Binary file not shown.
50 changes: 50 additions & 0 deletions assignments/hw18/book_attraction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"browsing": {
"request": {
"date": "2024-07-15",
"city": "New York",
"state": "NY",
"budget": 30
},
"response": {
"date": "2024-07-15",
"city": "New York",
"state": "NY",
"budget": 30,
"attractions": [
{
"id": "nyc-museum2",
"name": "Museum of Modern Art",
"fee": 0
},
{
"id": "nyc-statue1",
"name": "Statue of Liberty",
"fee": 25
}
]
}
},
"booking": {
"request": {
"date": "2024-07-15",
"guest_count": 1,
"attraction": {
"id": "nyc-museum2",
"name": "Museum of Modern Art",
"open_time": "7:30:00",
"close_time": "21:00:00"
}
},
"response": {
"date": "2024-07-15",
"guest_count": 1,
"attraction": {
"id": "nyc-museum2",
"name": "Museum of Modern Art",
"open_time": "7:30:00",
"close_time": "21:00:00"
}
}
}
}
43 changes: 43 additions & 0 deletions assignments/hw18/book_flight.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"request": {
"departure_date": "2024-07-14",
"return_date": "2024-07-17",
"origin": "Chicago",
"destination": "New York",
"passengers": [
{
"name": "John Doe",
"passport_no": "E00007730"
}
],
"payment": {
"amount": 80,
"method": "VISA",
"account": "0987654321"
}
},
"response": {
"booking_id": "xa12gw3va0",
"flights": [
{
"no": "BA212",
"when": "2024-07-14",
"from": "ORD",
"to": "JFK"
},
{
"no": "AB121",
"when": "2024-07-21",
"from": "JFK",
"to": "ORD"
}
],
"passengers": [
{
"name": "John Doe",
"passport_no": "E00007730",
"seat": "12C"
}
]
}
}
36 changes: 36 additions & 0 deletions assignments/hw18/book_hotel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"request": {
"check_in_date": "2024-07-14",
"check_out_date": "2024-07-17",
"room_count": 1,
"hotel": {
"name": "Hard Rock Hotel",
"address": "159 West 48th St.",
"city": "New York",
"state": "NY"
},
"payment": {
"amount": 360,
"method": "paypal",
"account ": "johndoe"
}
},
"response": {
"booking_id": "k12vzd80v2",
"check_in_date": "2024-07-14",
"check_out_date": "2024-07-17",
"room_count": 1,
"hotel": {
"name": "Hard Rock Hotel",
"address": "159 West 48th St.",
"city": "New York",
"state": "NY",
"services": {
"wifi": true,
"breakfast": true,
"room_service": true,
"nightclub": false
}
}
}
}
37 changes: 37 additions & 0 deletions assignments/hw18/book_taxi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"request": {
"time": "2024-07-14T13:00:00",
"passenger_count": 2,
"pickup_location": {
"lat": 9.96233,
"lng": 49.80404
},
"dropoff_location": {
"lat": 6.11499,
"lng": 50.67891
},
"payment": {
"amount": 32,
"method": "cash"
}
},
"response": {
"booking_id": "9dvb1324bn",
"time": "2024-07-14T13:00:00",
"passenger_count": 2,
"pickup_location": {
"address": "959 N Western Ave",
"city": "Chicago",
"state": "IL",
"lat": 9.96233,
"lng": 49.80404
},
"dropoff_location": {
"address": "O'Hare International Airport",
"city": "Chicago",
"state": "IL",
"lat": 6.11499,
"lng": 50.67891
}
}
}
Loading

0 comments on commit 8518323

Please sign in to comment.