Skip to content

Commit

Permalink
rds tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
ftc13184-SK committed Jun 5, 2023
1 parent a738f9e commit d8d9423
Show file tree
Hide file tree
Showing 4 changed files with 410 additions and 16 deletions.
160 changes: 160 additions & 0 deletions _notebooks/2023-04-20-test.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test\n",
"- toc: true \n",
"- badges: true\n",
"- comments: true\n",
"- categories: [jupyter, FRQs]\n",
"- image: images/chart-preview.png"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"1. Define 1 argument constructor for Java for book\n",
"2. Define toString method for title, and a testor method\n",
"3. Generate unique id for class\n",
"4. Create a public getter that has a book count\n",
"5. Define tester method that intializes st least 2 books, outputs id and title, and provides a count of books in library"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"public class Book\n",
"{\n",
" String = title; \n",
" double = id; \n",
" int = numberOfBooks;\n",
" int1 = book1;\n",
" int2 = book2;\n",
"\n",
" String () = booktitle;\n",
" {\n",
" public Book (title)\n",
" {\n",
" double bookCount = int1 + int2;\n",
" this.get = bookCount;\n",
"\n",
" }\n",
" \n",
" public void toString \n",
" {\n",
" this.get = bookCount;\n",
" this.generate \n",
" }\n",
" }\n",
" System.out.println(\"There are two books in the library\");\n",
" System.out.println(\"\")\n",
" System.out.println(\"The number of books is\" +bookCount \"in the library\");\n",
" return bookCount; \n",
"}"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Part 1"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Title: Brave New World, ID: 1\n",
"Title: Things Fall Apart, ID: 2\n",
"Total number of books: 2\n"
]
}
],
"source": [
"public class Book {\n",
" private static int bookCount = 0;\n",
" private int id;\n",
" private String title;\n",
" \n",
" public Book(String title) {\n",
" this.title = title;\n",
" id = ++bookCount;\n",
" }\n",
" \n",
" @Override\n",
" public String toString() {\n",
" return \"Title: \" + title;\n",
" }\n",
" \n",
" public int getId() {\n",
" return id;\n",
" }\n",
" \n",
" public static int getBookCount() {\n",
" return bookCount;\n",
" }\n",
" public static void main(String[] args) {\n",
" Book book1 = new Book(\"Brave New World\");\n",
" Book book2 = new Book(\"Things Fall Apart\");\n",
" \n",
" System.out.println(book1.toString() + \", ID: \" + book1.getId());\n",
" System.out.println(book2.toString() + \", ID: \" + book2.getId());\n",
" System.out.println(\"Total number of books: \" + Book.getBookCount());\n",
" }\n",
"}\n",
"Book.main(null);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"public class Fiction extends Book\n",
"{\n",
" private String title; \n",
" private String author; \n",
" private String shelfLife; \n",
" \n",
" \n",
"\n",
"\n",
"}"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Java",
"language": "java",
"name": "java"
},
"language_info": {
"codemirror_mode": "java",
"file_extension": ".jshell",
"mimetype": "text/x-java-source",
"name": "java",
"pygments_lexer": "java",
"version": "11.0.16+8-post-Ubuntu-0ubuntu120.04"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 4 additions & 16 deletions _notebooks/2023-04-25-units-1-4-hacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -69,11 +65,7 @@
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -154,11 +146,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"metadata": {},
"outputs": [],
"source": [
"public class Car {\n",
Expand Down Expand Up @@ -230,7 +218,7 @@
"codemirror_mode": "java",
"file_extension": ".jshell",
"mimetype": "text/x-java-source",
"name": "Java",
"name": "java",
"pygments_lexer": "java",
"version": "11.0.16+8-post-Ubuntu-0ubuntu120.04"
},
Expand Down
Empty file.
Loading

0 comments on commit d8d9423

Please sign in to comment.