Skip to content

Rahaf Alghamdi #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions quiz_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
3 changes: 3 additions & 0 deletions quiz_app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
2 changes: 2 additions & 0 deletions quiz_app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.
30 changes: 30 additions & 0 deletions quiz_app/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -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
92 changes: 92 additions & 0 deletions quiz_app/bin/quiz_app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import 'dart:io';

void main(List<String> arguments) {
List numbers = [1, 2, 3, 4, 5, 6];

// 1
print(
"\n \n -------- What is the first satage in git, choose the right answer:");
print("a. untrackes ");
print("b. commited");
print("c. staged");

String answer1 = stdin.readLineSync()!;
print(quiz(answer: answer1));

//2
print("\n \n -------- add commands you know in git:");
String answer2 = stdin.readLineSync()!;
print(quiz(answer: answer2));

//3
print(" \n \n -------- add your username in github:");
String username = stdin.readLineSync()!;
print(" \n -------- add your email in github:");
String email = stdin.readLineSync()!;

printUser(username: username, email: email);

//4
print(addEven(numbers: numbers));

//5
print(" \n \n -------- add length:");
int length = int.parse(stdin.readLineSync()!);
print(" \n -------- add width:");
int width = int.parse(stdin.readLineSync()!);
print(calculateArea(length: length, width: width));
}

//function 1
quiz({required String answer}) {
switch (answer) {
case "a":
print("\n correct answer");
break;
case "b":
print("\n wrong answer");
break;
case "c":
print("\n wrong answer");
break;
default:
}

return answer;
}

//function 2

addGitCommands({required String commands}) {
List gitcommands = [];

gitcommands.add(commands);

return gitcommands;
}

// function 3

printUser({required String username, required String email}) {
print(username);
print(email);
}

//function 4

int addEven({required List numbers}) {
int count = 0;

for (int element in numbers) {
if (element % 2 == 0) {
count += element;
}
}
return count;
}

//function 5
int calculateArea({required int length, required int width}) {
int area = length * width;
return area;
}
Loading