Skip to content

Commit 004854d

Browse files
authored
Merge branch 'code-differently:main' into Work17
2 parents 108b1d9 + 736fa54 commit 004854d

File tree

387 files changed

+57675
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

387 files changed

+57675
-7
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Lesson 26 Java Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_26/api/java/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '21'
24+
distribution: 'temurin'
25+
26+
- name: Build Lesson 26 with Java
27+
working-directory: ./lesson_26/api/java
28+
run: ./gradlew check
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Lesson 26 TS Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_26/api/javascript/api_app/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20.x'
23+
24+
- name: Build Lesson 26 with Node.js
25+
working-directory: ./lesson_26/api/javascript/api_app
26+
run: |
27+
npm ci
28+
npm run check

.github/workflows/check_push.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,13 @@ jobs:
164164
working-directory: ./lesson_17/bank
165165
run: ./gradlew check
166166

167+
- name: Build Lesson 26 with Java
168+
working-directory: ./lesson_26/api/java
169+
run: ./gradlew assemble
170+
171+
- name: Build Lesson 26 with Node.js
172+
working-directory: ./lesson_26/api/javascript/api_app
173+
run: |
174+
npm ci
175+
npm run build
176+

capstone/README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Capstone Project
2+
3+
For the next two weeks, you and your team will ideate and implement a working software system. You will have the opportunity to apply the skills that you have learned to solve an interesting problem or contribute a meaningful tool that improves our lives.
4+
5+
### Changelog
6+
- 4/24 @anthonydmays Published initial version
7+
8+
### Technical Requirements
9+
10+
Your project submission must include the following elements:
11+
12+
* All work must be submitted in your team's assigned GitHub repository. Your team must track issues, bugs, pull requests, and features. See [Lesson 05][lesson-05] for a refresh.
13+
* Each team member must contribute *at least two* submitted pull requests containing working code and tests. See [Lesson 15][lesson-15] for a refresh.
14+
* Write unit tests achieving 80% code coverage (using JaCoCo for Java or Jest for Typescript).
15+
* Must have a working front-end that interacts with a back-end web service to retrieve and persist data.
16+
* Your app must be publicly accessible. It is recommended that you use [Vercel](https://vercel.com) or [Fly.io](https://fly.io) to deploy your apps.
17+
* The system must incorporate one third-party API.
18+
* Your repo must include a README with the following elements:
19+
* The team
20+
* Screenshot
21+
* A description of the app
22+
* Demo link
23+
* Installation instructions
24+
* Known issues
25+
* Roadmap features
26+
* Credits
27+
* It is **HIGHLY** recommended that you maintain a clean `Main` branch and only merge changes via pull requests (we've been using squashed merges for the main repo to simplify commit history). Don't forget to use [Conventional Commits][conventional-commits-link].
28+
29+
### Important Milestones
30+
31+
To ensure the timely completion of your project, you will need to complete the following milestone tasks.
32+
33+
<table>
34+
<thead>
35+
<th>Milestone</th>
36+
<th>Date</th>
37+
</thead>
38+
<tbody>
39+
<tr>
40+
<td>Submit user stories to your repo as GitHub issues</td>
41+
<td>Thurs, May 8</td>
42+
</tr>
43+
<tr>
44+
<td>
45+
Obtain project sign-off from instructor/TAs<br>
46+
<a href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1dD0ruj64FcykMfPBo7qQaV6AqZ58O7ON8Z3ld-xwNEbFmy0JGyLuwIwxJZjoGoEuz1U9bRZqu">
47+
Schedule a review meeting here
48+
</a>
49+
</td>
50+
<td>Fri, May 9</td>
51+
</tr>
52+
<tr>
53+
<td>Hold Sprint planning meeting</td>
54+
<td>Mon, May 12</td>
55+
</tr>
56+
<tr>
57+
<td>Begin implementing your designs</td>
58+
<td>Mon, May 12</td>
59+
</tr>
60+
<tr>
61+
<td>Update your meeting notes document</td>
62+
<td>Daily</td>
63+
</tr>
64+
<tr>
65+
<td>
66+
Practice presentation sessions
67+
</td>
68+
<td>Wed-Thurs, May 21-22</td>
69+
</tr>
70+
<tr>
71+
<td>Presentations due</td>
72+
<td>Thurs, May 22, EOD</td>
73+
</tr>
74+
<tr>
75+
<td>Final presentations</td>
76+
<td>Fri, May 23</td>
77+
</tr>
78+
</tbody>
79+
</table>
80+
81+
### Helpful Resources
82+
83+
Here are some links to tools and templates that can help you work together effectively.
84+
85+
* [TODO App (fullstack NextJS app in TypeScript)](/lib/javascript/fullstack_demo)
86+
* [TODO App (fullstack React + Java Spring app in TypeScript/Java)](/lib/java/fullstack_demo)
87+
* [v0 (chatbot for generating UI and web applications)](https://v0.dev)
88+
* [A Short Guide to Effective Daily Standups (Nave)](https://getnave.com/blog/short-guide-daily-standups/)
89+
* [Team Meeting Notes template (Google Docs)](https://docs.google.com/document/d/1rL-Zm2w0hABuGkIMSPzmXcJHDQxmIeA-mlipt8kDA9E/edit)
90+
* [Crafting Effective User Stories: A Guide to Good and Bad Versions (Visual Paradigm)](https://guides.visual-paradigm.com/crafting-effective-user-stories-a-guide-to-good-and-bad-versions/)
91+
* [Third-party APIs (MDN)](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Third_party_APIs)
92+
* [GitHub Flow (GitHub.com)](https://docs.github.com/en/get-started/using-github/github-flow)
93+
* The Software Engineer's Guidebook, Chapter 10, "Tools of the Productive Software Engineer."
94+
95+
### Presentation Guidelines
96+
97+
For your presentation, you will be given up to 20 minutes to feature your project. Each person on the team should have a speaking role. Here's what your presentation will contain:
98+
99+
1. Up to four slides of content, then a live demo walkthrough.
100+
2. Your presentation should cover the following items, in order:
101+
- [ ] Introduce team members and their roles
102+
- [ ] State the problem your attempting to solve
103+
- [ ] State how your app is designed to solve the problem
104+
- [ ] Show your demo
105+
- [ ] Discuss how you'd like to enhance in the future
106+
- [ ] Lastly, talk through technical challenges and features.
107+
3. You will be given 5 minutes for Q&A and take questions from the audience.
108+
109+
### Academic Integrity
110+
111+
Please refer to the [Academic Integrity][academic-integrity-link] section of the syllabus regarding the use of third-party code and resources that you have used for your project. Give credit to where credit is due!
112+
113+
[conventional-commits-link]: https://www.conventionalcommits.org/en/v1.0.0/
114+
[academic-integrity-link]: /syllabus/README.md#academic-integrity
115+
[lesson-05]: /lesson_05/README.md
116+
[lesson-15]: /lesson_15/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.codedifferently.lesson16.dylans_xbox;
2+
3+
public class DiskDriveFullException extends Exception {
4+
public DiskDriveFullException(String message) {
5+
super(message);
6+
}
7+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.codedifferently.lesson16.dylans_xbox;
2+
3+
import java.io.BufferedReader;
4+
import java.io.FileReader;
5+
import java.io.IOException;
6+
7+
public class LoadGame {
8+
private String filePath;
9+
10+
public LoadGame(String filePath) {
11+
this.filePath = filePath;
12+
}
13+
14+
public void loadGamesFromFile(Xbox xbox) throws Exception {
15+
try (BufferedReader br = new BufferedReader(new FileReader(filePath))) {
16+
String line;
17+
br.readLine(); // Skip the header line
18+
while ((line = br.readLine()) != null) {
19+
String[] gameDetails = line.split(",");
20+
if (gameDetails.length >= 2) {
21+
22+
int id = Integer.parseInt(gameDetails[0].trim());
23+
String name = gameDetails[1].trim();
24+
xbox.getGames().put(id, name);
25+
}
26+
}
27+
} catch (IOException e) {
28+
throw new Exception("Error reading the games file: " + e.getMessage());
29+
}
30+
}
31+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.codedifferently.lesson16.dylans_xbox;
2+
3+
import java.util.ArrayList;
4+
import java.util.HashMap;
5+
6+
public class Xbox {
7+
private ArrayList<String> insertedGames = new ArrayList<>();
8+
private HashMap<Integer, String> games;
9+
// Declares the model of the Xbox by using the enum XboxModel
10+
private XboxModel model;
11+
private String color;
12+
private int price;
13+
// Declares if there is a disk drive on the Xbox
14+
private boolean diskDrive = false;
15+
16+
// Defines a fixed set of constants for GameGenre
17+
public enum XboxModel {
18+
XBOX360,
19+
XBOXONE,
20+
XBOXONES,
21+
XBOXONEX,
22+
XBOXSERIESS,
23+
XBOXSERIESX
24+
}
25+
26+
// Constructor for the Xbox class
27+
public Xbox(String model, int price, String color, boolean diskDrive, boolean diskDriveFull) {
28+
this.model = XboxModel.valueOf(model.toUpperCase());
29+
this.price = price;
30+
this.color = color;
31+
this.diskDrive = diskDrive;
32+
this.insertedGames = new ArrayList<>();
33+
this.games = new HashMap<>();
34+
}
35+
36+
public int getInsertedGamesSize() {
37+
return insertedGames.size();
38+
}
39+
40+
// Getters for the Xbox class
41+
public XboxModel getModel() {
42+
return model;
43+
}
44+
45+
public HashMap<Integer, String> getGames() {
46+
return games;
47+
}
48+
49+
public int getPrice() {
50+
return price;
51+
}
52+
53+
public String getColor() {
54+
return color;
55+
}
56+
57+
public boolean DiskDrive() {
58+
return diskDrive;
59+
}
60+
61+
// Method that will add a game to the disk drive
62+
// it will check if the disk drive is empty and if it is, it will add the game to the disk drive
63+
// by turning it to true.
64+
public void inputGame(int id) throws Exception {
65+
if (!diskDrive) {
66+
throw new Exception("This Xbox does not have a disk drive. Cannot insert game.");
67+
}
68+
if (insertedGames.size() >= 2) {
69+
throw new DiskDriveFullException("Disk drive is full. Cannot insert game.");
70+
}
71+
72+
String gameName = games.get(id);
73+
if (gameName == null) {
74+
throw new Exception("Game with ID: " + id + " does not exist in the library.");
75+
}
76+
if (insertedGames.contains(gameName)) {
77+
throw new Exception("Game \"" + gameName + "\" is already inserted.");
78+
}
79+
80+
insertedGames.add(gameName);
81+
games.remove(id);
82+
83+
System.out.println("Game \"" + gameName + "\" (ID: " + id + ") was added to the disk drive.");
84+
}
85+
86+
// Method that will eject a game from the disk drive
87+
// it will check if the game is in the drive and if it is, it will turn the drive to false.
88+
public void ejectGame(int id) {
89+
if (insertedGames.size() >= 1) {
90+
insertedGames.removeAll(insertedGames);
91+
System.out.println("Game with ID: " + id + " was ejected from the disk drive.");
92+
} else {
93+
System.out.println("Game with ID: " + id + " not found in the disk drive.");
94+
}
95+
}
96+
97+
// This method will print all the games in the HashMap
98+
// By running a for loop that will iterate through the games
99+
public void printAllGames() {
100+
for (Integer id : games.keySet()) {
101+
System.out.println("Game ID: " + id + ", Game Name: " + games.get(id));
102+
}
103+
}
104+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
id, name
2+
1, Call of Duty
3+
2, Elden Ring
4+
3, Minecraft
5+
4, Monster Hunter
6+
5, Fortnite
7+
6, Marvel Rivals
8+
7, Tetris
9+
8, Madden NFL
10+
9, Terraria
11+
10,Baldur's Gate 3

0 commit comments

Comments
 (0)