Skip to content

Commit

Permalink
FRQ update
Browse files Browse the repository at this point in the history
  • Loading branch information
PranavP04 committed Apr 28, 2023
1 parent f5f22e8 commit 7653db7
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _notebooks/2023-04-23-Hacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 1,
"metadata": {
"vscode": {
"languageId": "java"
Expand Down
99 changes: 99 additions & 0 deletions _notebooks/2023-04-28-FRQ's.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Classes FRQ"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2\n",
"5\n",
"8\n",
"11\n",
"8\n",
"5\n",
"2\n",
"2\n"
]
}
],
"source": [
"public class AdditionPattern {\n",
" private int current;\n",
" private int increment;\n",
" \n",
" public AdditionPattern(int start, int inc) {\n",
" current = start;\n",
" increment = inc;\n",
" }\n",
" // Variable sets integer currentNumber and returns the current value\n",
" public int currentNumber() {\n",
" return current;\n",
" }\n",
" // Increments the values\n",
" public void next() {\n",
" current += increment;\n",
" }\n",
" // Subtracts Values\n",
" public void prev() {\n",
" if (current > increment) {\n",
" current -= increment;\n",
" }\n",
" }\n",
"\n",
" public static void main(String[] args) {\n",
" AdditionPattern plus3 = new AdditionPattern(2, 3);\n",
" System.out.println(plus3.currentNumber()); // expected output: 2\n",
" plus3.next();\n",
" System.out.println(plus3.currentNumber()); // expected output: 5\n",
" plus3.next();\n",
" System.out.println(plus3.currentNumber()); // expected output: 8\n",
" plus3.next();\n",
" System.out.println(plus3.currentNumber()); // expected output: 11\n",
" plus3.prev();\n",
" System.out.println(plus3.currentNumber()); // expected output: 8\n",
" plus3.prev();\n",
" System.out.println(plus3.currentNumber()); // expected output: 5\n",
" plus3.prev();\n",
" System.out.println(plus3.currentNumber()); // expected output: 2\n",
" plus3.prev();\n",
" System.out.println(plus3.currentNumber()); // expected output: 2\n",
" }\n",
"}\n",
"AdditionPattern.main(null);\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": "18.0.2+0"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 7653db7

Please sign in to comment.