From d1f4db71800aec7d664007ef23143af39a66c4a2 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 14:56:06 +0300 Subject: [PATCH 1/9] Function for exploring git --- quiz_app/.gitignore | 3 + quiz_app/CHANGELOG.md | 3 + quiz_app/README.md | 2 + quiz_app/analysis_options.yaml | 30 +++ quiz_app/bin/git.dart | 3 + quiz_app/bin/quiz_app.dart | 35 +++ quiz_app/lib/quiz_app.dart | 3 + quiz_app/pubspec.lock | 402 +++++++++++++++++++++++++++++++ quiz_app/pubspec.yaml | 15 ++ quiz_app/test/quiz_app_test.dart | 8 + 10 files changed, 504 insertions(+) create mode 100644 quiz_app/.gitignore create mode 100644 quiz_app/CHANGELOG.md create mode 100644 quiz_app/README.md create mode 100644 quiz_app/analysis_options.yaml create mode 100644 quiz_app/bin/git.dart create mode 100644 quiz_app/bin/quiz_app.dart create mode 100644 quiz_app/lib/quiz_app.dart create mode 100644 quiz_app/pubspec.lock create mode 100644 quiz_app/pubspec.yaml create mode 100644 quiz_app/test/quiz_app_test.dart diff --git a/quiz_app/.gitignore b/quiz_app/.gitignore new file mode 100644 index 0000000..3a85790 --- /dev/null +++ b/quiz_app/.gitignore @@ -0,0 +1,3 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ diff --git a/quiz_app/CHANGELOG.md b/quiz_app/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/quiz_app/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/quiz_app/README.md b/quiz_app/README.md new file mode 100644 index 0000000..3816eca --- /dev/null +++ b/quiz_app/README.md @@ -0,0 +1,2 @@ +A sample command-line application with an entrypoint in `bin/`, library code +in `lib/`, and example unit test in `test/`. diff --git a/quiz_app/analysis_options.yaml b/quiz_app/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/quiz_app/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/quiz_app/bin/git.dart b/quiz_app/bin/git.dart new file mode 100644 index 0000000..79f0229 --- /dev/null +++ b/quiz_app/bin/git.dart @@ -0,0 +1,3 @@ +void gitExplore() { + print("Git is a version control system"); +} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart new file mode 100644 index 0000000..9bafc58 --- /dev/null +++ b/quiz_app/bin/quiz_app.dart @@ -0,0 +1,35 @@ +import "dart:io"; +import "git.dart"; +import "github.dart"; + +void main() { + bool isExit = false; + print("Hello "); + print("Enter a number to explore the git and github:"); + print("1: Exploring Git"); + print("2: Exploring GitHub"); + print("3: You are a developer"); + print("4: Exit"); + int number = int.parse(stdin.readLineSync()!); + print("You entered: $number"); + do { + switch (number) { + case 1: + gitExplore(); + break; + case 2: + githubExplore(); + break; + case 3: + print("You are a developer"); + break; + case 4: + print("Exiting..."); + print("Goodbye"); + isExit = true; + break; + default: + print("Invalid number"); + } + } while (isExit); +} diff --git a/quiz_app/lib/quiz_app.dart b/quiz_app/lib/quiz_app.dart new file mode 100644 index 0000000..f64ad72 --- /dev/null +++ b/quiz_app/lib/quiz_app.dart @@ -0,0 +1,3 @@ +int calculate() { + return 6 * 7; +} diff --git a/quiz_app/pubspec.lock b/quiz_app/pubspec.lock new file mode 100644 index 0000000..af73031 --- /dev/null +++ b/quiz_app/pubspec.lock @@ -0,0 +1,402 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "5aaf60d96c4cd00fe7f21594b5ad6a1b699c80a27420f8a837f4d68473ef09e3" + url: "https://pub.dev" + source: hosted + version: "68.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.1.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "21f1d3720fd1c70316399d5e2bccaebb415c434592d778cce8acb967b8578808" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + args: + dependency: transitive + description: + name: args + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + url: "https://pub.dev" + source: hosted + version: "2.5.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" + url: "https://pub.dev" + source: hosted + version: "1.8.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "40f592dd352890c3b60fec1b68e786cefb9603e05ff303dbc4dda49b304ecdf4" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + lints: + dependency: "direct dev" + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + macros: + dependency: transitive + description: + name: macros + sha256: "12e8a9842b5a7390de7a781ec63d793527582398d16ea26c60fed58833c9ae79" + url: "https://pub.dev" + source: hosted + version: "0.1.0-main.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + mime: + dependency: transitive + description: + name: mime + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" + url: "https://pub.dev" + source: hosted + version: "1.25.8" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + test_core: + dependency: transitive + description: + name: test_core + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + url: "https://pub.dev" + source: hosted + version: "14.2.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.4.4 <4.0.0" diff --git a/quiz_app/pubspec.yaml b/quiz_app/pubspec.yaml new file mode 100644 index 0000000..b1fdbc4 --- /dev/null +++ b/quiz_app/pubspec.yaml @@ -0,0 +1,15 @@ +name: quiz_app +description: A sample command-line application. +version: 1.0.0 +# repository: https://github.com/my_org/my_repo + +environment: + sdk: ^3.4.4 + +# Add regular dependencies here. +dependencies: + # path: ^1.8.0 + +dev_dependencies: + lints: ^3.0.0 + test: ^1.24.0 diff --git a/quiz_app/test/quiz_app_test.dart b/quiz_app/test/quiz_app_test.dart new file mode 100644 index 0000000..d7dc3fa --- /dev/null +++ b/quiz_app/test/quiz_app_test.dart @@ -0,0 +1,8 @@ +import 'package:quiz_app/quiz_app.dart'; +import 'package:test/test.dart'; + +void main() { + test('calculate', () { + expect(calculate(), 42); + }); +} From 583e1b865a2c5c4ecfa393bdd9a327a4edc5f846 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 14:58:32 +0300 Subject: [PATCH 2/9] Function for exploring github --- quiz_app/bin/github.dart | 3 +++ quiz_app/bin/quiz_app.dart | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 quiz_app/bin/github.dart diff --git a/quiz_app/bin/github.dart b/quiz_app/bin/github.dart new file mode 100644 index 0000000..1b5520c --- /dev/null +++ b/quiz_app/bin/github.dart @@ -0,0 +1,3 @@ +void github() { + print("GitHub is a platform for developers"); +} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index 9bafc58..36217ed 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -1,6 +1,6 @@ import "dart:io"; import "git.dart"; -import "github.dart"; +import 'github.dart'; void main() { bool isExit = false; @@ -18,10 +18,9 @@ void main() { gitExplore(); break; case 2: - githubExplore(); + github(); break; case 3: - print("You are a developer"); break; case 4: print("Exiting..."); From eef785843d604c109655d1d6215fd0cab898c064 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 15:01:12 +0300 Subject: [PATCH 3/9] Function for You are dev --- quiz_app/bin/quiz_app.dart | 2 ++ quiz_app/bin/urdev.dart | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 quiz_app/bin/urdev.dart diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index 36217ed..d42d82c 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -1,6 +1,7 @@ import "dart:io"; import "git.dart"; import 'github.dart'; +import 'urdev.dart'; void main() { bool isExit = false; @@ -21,6 +22,7 @@ void main() { github(); break; case 3: + urDev(); break; case 4: print("Exiting..."); diff --git a/quiz_app/bin/urdev.dart b/quiz_app/bin/urdev.dart new file mode 100644 index 0000000..a84e598 --- /dev/null +++ b/quiz_app/bin/urdev.dart @@ -0,0 +1,3 @@ +void urDev() { + print("You are a developer"); +} From 3fa9bfb1e844323dfb79918f237f040f3335a268 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 15:08:14 +0300 Subject: [PATCH 4/9] Function for GitHub account --- quiz_app/bin/account.dart | 3 +++ quiz_app/bin/quiz_app.dart | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 quiz_app/bin/account.dart diff --git a/quiz_app/bin/account.dart b/quiz_app/bin/account.dart new file mode 100644 index 0000000..ad50178 --- /dev/null +++ b/quiz_app/bin/account.dart @@ -0,0 +1,3 @@ +void account() { + print("My GitHub account is @imahacs"); +} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index d42d82c..552f704 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -10,7 +10,9 @@ void main() { print("1: Exploring Git"); print("2: Exploring GitHub"); print("3: You are a developer"); - print("4: Exit"); + print("4: Git and GitHub account"); + print("5: Basics commands"); + print("6: Exit"); int number = int.parse(stdin.readLineSync()!); print("You entered: $number"); do { @@ -25,6 +27,10 @@ void main() { urDev(); break; case 4: + break; + case 5: + break; + case 6: print("Exiting..."); print("Goodbye"); isExit = true; From 3c3ef4fa7ce630dbd47391147aefab46d2ab8b93 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 19:03:25 +0300 Subject: [PATCH 5/9] Edit first function & deleted unused files --- quiz_app/bin/account.dart | 3 --- quiz_app/bin/git.dart | 3 --- quiz_app/bin/gitdef.dart | 24 ++++++++++++++++++ quiz_app/bin/github.dart | 3 --- quiz_app/bin/quiz_app.dart | 51 +++++++++----------------------------- quiz_app/bin/urdev.dart | 3 --- 6 files changed, 36 insertions(+), 51 deletions(-) delete mode 100644 quiz_app/bin/account.dart delete mode 100644 quiz_app/bin/git.dart create mode 100644 quiz_app/bin/gitdef.dart delete mode 100644 quiz_app/bin/github.dart delete mode 100644 quiz_app/bin/urdev.dart diff --git a/quiz_app/bin/account.dart b/quiz_app/bin/account.dart deleted file mode 100644 index ad50178..0000000 --- a/quiz_app/bin/account.dart +++ /dev/null @@ -1,3 +0,0 @@ -void account() { - print("My GitHub account is @imahacs"); -} diff --git a/quiz_app/bin/git.dart b/quiz_app/bin/git.dart deleted file mode 100644 index 79f0229..0000000 --- a/quiz_app/bin/git.dart +++ /dev/null @@ -1,3 +0,0 @@ -void gitExplore() { - print("Git is a version control system"); -} diff --git a/quiz_app/bin/gitdef.dart b/quiz_app/bin/gitdef.dart new file mode 100644 index 0000000..affeffc --- /dev/null +++ b/quiz_app/bin/gitdef.dart @@ -0,0 +1,24 @@ +import 'dart:io'; + +question1(int degree) { + Map question1 = { + "a": "A version control system", + "b": "A programming language", + "c": "A database", + "d": "A software development tool" + }; + var correctAnswer = "a"; + print("a: ${question1["a"]}"); + print("b: ${question1["b"]}"); + print("c: ${question1["c"]}"); + print("d: ${question1["d"]}"); + print("Enter your answer: "); + var userAnswer = stdin.readLineSync(); + if (userAnswer == correctAnswer) { + print("Correct!"); + degree++; + print("Your score is: $degree"); + } else { + print("Incorrect! The correct answer is: ${question1[correctAnswer]}"); + } +} diff --git a/quiz_app/bin/github.dart b/quiz_app/bin/github.dart deleted file mode 100644 index 1b5520c..0000000 --- a/quiz_app/bin/github.dart +++ /dev/null @@ -1,3 +0,0 @@ -void github() { - print("GitHub is a platform for developers"); -} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index 552f704..65ae4ee 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -1,42 +1,15 @@ -import "dart:io"; -import "git.dart"; -import 'github.dart'; -import 'urdev.dart'; +import 'gitdef.dart'; void main() { - bool isExit = false; - print("Hello "); - print("Enter a number to explore the git and github:"); - print("1: Exploring Git"); - print("2: Exploring GitHub"); - print("3: You are a developer"); - print("4: Git and GitHub account"); - print("5: Basics commands"); - print("6: Exit"); - int number = int.parse(stdin.readLineSync()!); - print("You entered: $number"); - do { - switch (number) { - case 1: - gitExplore(); - break; - case 2: - github(); - break; - case 3: - urDev(); - break; - case 4: - break; - case 5: - break; - case 6: - print("Exiting..."); - print("Goodbye"); - isExit = true; - break; - default: - print("Invalid number"); - } - } while (isExit); + print("_________________________________\n"); + print("Quiz: Git and GitHub Quiz"); + print("Date: ${DateTime.now()}\n"); + print("_________________________________\n"); + print(" Welcome to the Git and GitHub quiz\n"); + print("This quiz will help you understand Git and GitHub"); + print("Good luck!\n\n\n"); + print("Question 1: Multiple Choice"); + print("_________________________________\n"); + print("What is Git?\n"); + question1(0); } diff --git a/quiz_app/bin/urdev.dart b/quiz_app/bin/urdev.dart deleted file mode 100644 index a84e598..0000000 --- a/quiz_app/bin/urdev.dart +++ /dev/null @@ -1,3 +0,0 @@ -void urDev() { - print("You are a developer"); -} From a4d587c2f8b6eb8005e0e87113bc56c1d73f4c51 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 19:39:17 +0300 Subject: [PATCH 6/9] Edit second function --- quiz_app/bin/gitcommands.dart | 0 quiz_app/bin/gitdef.dart | 26 +++++++++++++++----------- quiz_app/bin/githubdef.dart | 28 ++++++++++++++++++++++++++++ quiz_app/bin/quiz_app.dart | 12 ++++++++++-- 4 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 quiz_app/bin/gitcommands.dart create mode 100644 quiz_app/bin/githubdef.dart diff --git a/quiz_app/bin/gitcommands.dart b/quiz_app/bin/gitcommands.dart new file mode 100644 index 0000000..e69de29 diff --git a/quiz_app/bin/gitdef.dart b/quiz_app/bin/gitdef.dart index affeffc..a47ac83 100644 --- a/quiz_app/bin/gitdef.dart +++ b/quiz_app/bin/gitdef.dart @@ -1,24 +1,28 @@ import 'dart:io'; -question1(int degree) { +// This function is used to ask the first question +int question1(int degree) { Map question1 = { - "a": "A version control system", - "b": "A programming language", - "c": "A database", - "d": "A software development tool" + "1": "A version control system", + "2": "A programming language", + "3": "A database", + "4": "A software development tool" }; - var correctAnswer = "a"; - print("a: ${question1["a"]}"); - print("b: ${question1["b"]}"); - print("c: ${question1["c"]}"); - print("d: ${question1["d"]}"); + var correctAnswer = "1"; + + print("What is Git?\n"); + print("1: ${question1["1"]}"); + print("2: ${question1["2"]}"); + print("3: ${question1["3"]}"); + print("4: ${question1["4"]}"); print("Enter your answer: "); + var userAnswer = stdin.readLineSync(); if (userAnswer == correctAnswer) { print("Correct!"); degree++; - print("Your score is: $degree"); } else { print("Incorrect! The correct answer is: ${question1[correctAnswer]}"); } + return degree; } diff --git a/quiz_app/bin/githubdef.dart b/quiz_app/bin/githubdef.dart new file mode 100644 index 0000000..4311e1a --- /dev/null +++ b/quiz_app/bin/githubdef.dart @@ -0,0 +1,28 @@ +import 'dart:io'; + +// This function is used to ask the second question +int question2(int degree) { + Map question2 = { + "1": "A database management system (DBMS)", + "2": "A programming language", + "3": "A web-based platform for version control and collaboration", + "4": "An operating system" + }; + var correctAnswer = "3"; + + print("What is GitHub?\n"); + print("1: ${question2["1"]}"); + print("2: ${question2["2"]}"); + print("3: ${question2["3"]}"); + print("4: ${question2["4"]}"); + print("Enter your answer: "); + + var userAnswer = stdin.readLineSync(); + if (userAnswer == correctAnswer) { + print("Correct!"); + degree++; + } else { + print("Incorrect! The correct answer is: ${question2[correctAnswer]}"); + } + return degree; +} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index 65ae4ee..f8ea909 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -1,6 +1,9 @@ +import 'dart:io'; import 'gitdef.dart'; +import 'githubdef.dart'; void main() { + int degree = 0; print("_________________________________\n"); print("Quiz: Git and GitHub Quiz"); print("Date: ${DateTime.now()}\n"); @@ -8,8 +11,13 @@ void main() { print(" Welcome to the Git and GitHub quiz\n"); print("This quiz will help you understand Git and GitHub"); print("Good luck!\n\n\n"); + print("Question 1: Multiple Choice"); print("_________________________________\n"); - print("What is Git?\n"); - question1(0); + + degree = question1(degree); + degree = question2(degree); + + print("_________________________________\n"); + print("Your final score is: $degree"); } From ae3e49cb08cc139166327fbcbec3a3bdc96e1916 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 19:45:37 +0300 Subject: [PATCH 7/9] Add three function --- quiz_app/bin/gitcommands.dart | 28 ++++++++++++++++++++++++++++ quiz_app/bin/quiz_app.dart | 2 ++ 2 files changed, 30 insertions(+) diff --git a/quiz_app/bin/gitcommands.dart b/quiz_app/bin/gitcommands.dart index e69de29..3760b85 100644 --- a/quiz_app/bin/gitcommands.dart +++ b/quiz_app/bin/gitcommands.dart @@ -0,0 +1,28 @@ +import 'dart:io'; + +// This function is used to ask the second question +int question3(int degree) { + Map question3 = { + "1": "git add, git commit, git push", + "2": "git pull, git push, git commit", + "3": "git init, git add, git commit", + "4": "git clone, git add, git commit" + }; + var correctAnswer = "1"; + + print("What are the three main commands to upload project in GitHub?\n"); + print("1: ${question3["1"]}"); + print("2: ${question3["2"]}"); + print("3: ${question3["3"]}"); + print("4: ${question3["4"]}"); + print("Enter your answer: "); + + var userAnswer = stdin.readLineSync(); + if (userAnswer == correctAnswer) { + print("Correct!"); + degree++; + } else { + print("Incorrect! The correct answer is: ${question3[correctAnswer]}"); + } + return degree; +} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index f8ea909..af6105e 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'gitdef.dart'; import 'githubdef.dart'; +import 'gitcommands.dart'; void main() { int degree = 0; @@ -17,6 +18,7 @@ void main() { degree = question1(degree); degree = question2(degree); + degree = question3(degree); print("_________________________________\n"); print("Your final score is: $degree"); From 1f9130f6d756bc470f64941a88c565087f93b850 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 19:52:03 +0300 Subject: [PATCH 8/9] Add four function --- quiz_app/bin/gitcommands.dart | 2 +- quiz_app/bin/gittruefales.dart | 26 ++++++++++++++++++++++++++ quiz_app/bin/quiz_app.dart | 7 ++++++- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 quiz_app/bin/gittruefales.dart diff --git a/quiz_app/bin/gitcommands.dart b/quiz_app/bin/gitcommands.dart index 3760b85..fab6ba7 100644 --- a/quiz_app/bin/gitcommands.dart +++ b/quiz_app/bin/gitcommands.dart @@ -1,6 +1,6 @@ import 'dart:io'; -// This function is used to ask the second question +// This function is used to ask the three question int question3(int degree) { Map question3 = { "1": "git add, git commit, git push", diff --git a/quiz_app/bin/gittruefales.dart b/quiz_app/bin/gittruefales.dart new file mode 100644 index 0000000..67183d7 --- /dev/null +++ b/quiz_app/bin/gittruefales.dart @@ -0,0 +1,26 @@ +import 'dart:io'; + +// This function is used to ask the four question +int question4(int degree) { + Map question4 = { + "1": "True", + "2": "False", + }; + var correctAnswer = "2"; + + print("Git created by apple?\n"); + print("1: ${question4["1"]}"); + print("2: ${question4["2"]}"); + print("3: ${question4["3"]}"); + print("4: ${question4["4"]}"); + print("Enter your answer: "); + + var userAnswer = stdin.readLineSync(); + if (userAnswer == correctAnswer) { + print("Correct!"); + degree++; + } else { + print("Incorrect! The correct answer is: ${question4[correctAnswer]}"); + } + return degree; +} diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index af6105e..a44f266 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -1,7 +1,7 @@ -import 'dart:io'; import 'gitdef.dart'; import 'githubdef.dart'; import 'gitcommands.dart'; +import 'gittruefales.dart'; void main() { int degree = 0; @@ -21,5 +21,10 @@ void main() { degree = question3(degree); print("_________________________________\n"); + + print("Question 2: True or False"); + print("_________________________________\n"); + + degree = question4(degree); print("Your final score is: $degree"); } From b7ba948c1b9c850586d40a7f585c39c7fb548b36 Mon Sep 17 00:00:00 2001 From: MAHA Al-ATAWI Date: Wed, 31 Jul 2024 19:58:12 +0300 Subject: [PATCH 9/9] Add five function & testing app --- quiz_app/bin/githubtf.dart | 24 ++++++++++++++++++++++++ quiz_app/bin/gittruefales.dart | 2 -- quiz_app/bin/quiz_app.dart | 10 ++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 quiz_app/bin/githubtf.dart diff --git a/quiz_app/bin/githubtf.dart b/quiz_app/bin/githubtf.dart new file mode 100644 index 0000000..7082452 --- /dev/null +++ b/quiz_app/bin/githubtf.dart @@ -0,0 +1,24 @@ +import 'dart:io'; + +// This function is used to ask the five question +int question5(int degree) { + Map question5 = { + "1": "True", + "2": "False", + }; + var correctAnswer = "1"; + + print("GitHub launched on 2008?\n"); + print("1: ${question5["1"]}"); + print("2: ${question5["2"]}"); + print("Enter your answer: "); + + var userAnswer = stdin.readLineSync(); + if (userAnswer == correctAnswer) { + print("Correct!"); + degree++; + } else { + print("Incorrect! The correct answer is: ${question5[correctAnswer]}"); + } + return degree; +} diff --git a/quiz_app/bin/gittruefales.dart b/quiz_app/bin/gittruefales.dart index 67183d7..be49a00 100644 --- a/quiz_app/bin/gittruefales.dart +++ b/quiz_app/bin/gittruefales.dart @@ -11,8 +11,6 @@ int question4(int degree) { print("Git created by apple?\n"); print("1: ${question4["1"]}"); print("2: ${question4["2"]}"); - print("3: ${question4["3"]}"); - print("4: ${question4["4"]}"); print("Enter your answer: "); var userAnswer = stdin.readLineSync(); diff --git a/quiz_app/bin/quiz_app.dart b/quiz_app/bin/quiz_app.dart index a44f266..ac2dfa4 100644 --- a/quiz_app/bin/quiz_app.dart +++ b/quiz_app/bin/quiz_app.dart @@ -2,6 +2,7 @@ import 'gitdef.dart'; import 'githubdef.dart'; import 'gitcommands.dart'; import 'gittruefales.dart'; +import 'githubtf.dart'; void main() { int degree = 0; @@ -26,5 +27,14 @@ void main() { print("_________________________________\n"); degree = question4(degree); + degree = question5(degree); + + print("_________________________________\n"); print("Your final score is: $degree"); + + if (degree == 5) { + print("Congratulations! You have passed the quiz!"); + } else { + print("You have failed the quiz. Please try again."); + } }