From 7653db796164abf80903733fd24e93dbcb25b5d9 Mon Sep 17 00:00:00 2001 From: github Date: Fri, 28 Apr 2023 09:24:07 -0700 Subject: [PATCH] FRQ update --- _notebooks/2023-04-23-Hacks.ipynb | 2 +- _notebooks/2023-04-28-FRQ's.ipynb | 99 +++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 _notebooks/2023-04-28-FRQ's.ipynb diff --git a/_notebooks/2023-04-23-Hacks.ipynb b/_notebooks/2023-04-23-Hacks.ipynb index 4de4322..f1361f7 100644 --- a/_notebooks/2023-04-23-Hacks.ipynb +++ b/_notebooks/2023-04-23-Hacks.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 24, + "execution_count": 1, "metadata": { "vscode": { "languageId": "java" diff --git a/_notebooks/2023-04-28-FRQ's.ipynb b/_notebooks/2023-04-28-FRQ's.ipynb new file mode 100644 index 0000000..c19267c --- /dev/null +++ b/_notebooks/2023-04-28-FRQ's.ipynb @@ -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 +}