Skip to content
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

Assignment submission #74

Open
wants to merge 18 commits into
base: master
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
Binary file added session_1/solution/Output_Screenshot.docx
Binary file not shown.
29 changes: 29 additions & 0 deletions session_1/solution/arrayPrime.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'dart:ffi';
import "dart:io";
import "dart:core";
import 'dart:convert';

void main() {
print('Enter no of elements in array');
int? n = int.parse(stdin.readLineSync()!);
// ignore: deprecated_member_use_from_same_package
List<int> list = [];
int sum = 0;
print('Enter the array integers:');
for (int i = 0; i < n; i++) list.add(int.parse(stdin.readLineSync()!));
for (int j = 0; j < n; j++) {
if (isPrime(list.elementAt(j))) sum += list.elementAt(j);
}
if (isPrime(sum))
print('The sum of prime elements is prime');
else
print('The sum of prime elements is not prime');
}

bool isPrime(int n) {
if (n < 2) return false;
for (int j = 2; j <= (n / 2); j++) {
if (n % j == 0) return false;
}
return true;
}
113 changes: 113 additions & 0 deletions session_1/solution/electives.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
library electives;

import 'dart:io';

class BranchElective {
String courseName = "", courseCode = "", branch = "";
int year = 0;
BranchElective(String name, String code, String br, int yr) {
courseName = name;
courseCode = code;
branch = br;
year = yr;
}
String toString() {
String str = "$courseName \t $courseCode";
return str;
}

String getName() {
return courseName;
}

String getCode() {
return courseCode;
}

String getBranch() {
return branch;
}

int getYear() {
return year;
}
}

class OpenElective {
String courseName = "", courseCode = "";

OpenElective(String name, String code) {
courseName = name;
courseCode = code;
}
String getName() {
return courseName;
}

String getCode() {
return courseCode;
}

String toString() {
String str = "$courseName \t $courseCode";
return str;
}
}

void main() {
List<BranchElective> branch = [];
List<OpenElective> open = [];
int choice1, choice2;
do {
print("MENU :");
print('1.Admin');
print('2.Student');
print('Any other number for EXit');
choice1 = int.parse(stdin.readLineSync()!);
switch (choice1) {
case 1:
print('Enter course type');
print('1.Branch Elective');
print('2.Open Elective');
choice2 = int.parse(stdin.readLineSync()!);
if (choice2 == 1) {
print(
'Enter CourseName, CourseCode, Branch(2-letter code) and Year(1-4)');
String? str = stdin.readLineSync()!;
var spl = str.split(" ");
BranchElective br = new BranchElective(spl.elementAt(0),
spl.elementAt(1), spl.elementAt(2), int.parse(spl.elementAt(3)));
branch.add(br);
print('Added the course :)');
} else {
print('Enter CourseName, CourseCode');
String? str = stdin.readLineSync()!;
var spl = str.split(" ");
OpenElective op =
new OpenElective(spl.elementAt(0), spl.elementAt(1));
open.add(op);
print('Added the course :)');
}
break;
case 2:
print('Enter branch(2-letter code) and year(1-4) ');
String? str = stdin.readLineSync()!;
var spl = str.split(" ");
print('List of your Branch Electives :');
for (int i = 0; i < branch.length; i++) {
if ((branch.elementAt(i).branch.compareTo(spl.elementAt(0)) == 0) &&
(branch.elementAt(i).year == int.parse(spl.elementAt(1))))
print('${branch.elementAt(i).toString()}');
}
print('List of Open Electives:');
for (int j = 0; j < open.length; j++) {
OpenElective op = open.elementAt(j);
print('${op.toString()}');
}
break;
default:
print('Thanks for visiting :)');
print('EXITING');
}
} while ((choice1 == 1) || (choice1 == 2));
}
24 changes: 24 additions & 0 deletions session_1/solution/fibinocci.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'dart:io';

void main() {
print('Enter n');
int? n = int.parse(stdin.readLineSync()!);
print("First $n Fibinocci numbers are :");
fibo(n);
}

void fibo(int n) {
if (n <= 0) {
print('You have entered a non-positive number');
return;
}
if (n >= 1) print('0');
if (n >= 2) print('1');
int a = 0, b = 1, f;
for (int i = 2; i < n; i++) {
f = a + b;
print('$f');
a = b;
b = f;
}
}
31 changes: 31 additions & 0 deletions session_1/solution/semiPrime.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import "dart:io";

void main() {
print("Enter a number");
int? n = int.parse(stdin.readLineSync()!);
bool semi = semiPrime(n);
if (semi)
print("$n is a semi-prime number");
else
print("$n is not a semi-prime number");
}

bool semiPrime(int n) {
if (n == 1) return false;
if (n < 1) {
print('you have entered an invalid number');
return false;
}
if (isPrime(n)) return false;
for (int i = 4; i <= (n / 2); i++) {
if ((n % i == 0) && (!isPrime(i))) return false;
}
return true;
}

bool isPrime(int n) {
for (int j = 2; j <= (n / 2); j++) {
if (n % j == 0) return false;
}
return true;
}
Binary file added session_3/app_recording.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions session_3/build_trivia/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
10 changes: 10 additions & 0 deletions session_3/build_trivia/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
channel: stable

project_type: app
40 changes: 40 additions & 0 deletions session_3/build_trivia/.packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This file is deprecated. Tools should instead consume
# `.dart_tool/package_config.json`.
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2022-01-22 21:59:20.206259.
archive:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/
args:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
async:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/
boolean_selector:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/
characters:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.2.0/lib/
charcode:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.3.1/lib/
clock:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
collection:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/
convert:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib/
crypto:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.5/lib/
cupertino_icons:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/
fake_async:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib/
flutter:file:///C:/Users/admin/Documents/flutter/packages/flutter/lib/
flutter_launcher_icons:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.8.1/lib/
flutter_test:file:///C:/Users/admin/Documents/flutter/packages/flutter_test/lib/
http:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/
http_parser:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-4.0.0/lib/
image:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/
matcher:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11/lib/
meta:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/
path:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib/
petitparser:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/petitparser-3.1.0/lib/
sky_engine:file:///C:/Users/admin/Documents/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib/
stack_trace:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib/
stream_channel:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib/
string_scanner:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib/
term_glyph:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib/
test_api:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.4.3/lib/
typed_data:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib/
vector_math:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.1/lib/
xml:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/xml-4.5.1/lib/
yaml:file:///C:/Users/admin/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.2.1/lib/
gfgcustomfonts:lib/
Binary file not shown.
93 changes: 93 additions & 0 deletions session_3/build_trivia/OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2015-2021 The Luxurious Roman Project Authors (https://github.com/googlefonts/luxurious-roman)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading