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 3 submission - Todo App #55

Open
wants to merge 10 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
27 changes: 27 additions & 0 deletions Assignments/Session 1/q1.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'dart:io';

void fibonacci(int num){
int f1 = 1, f2 = 1, f3;

print('The fibonacci sequence is:');

stdout.write(f1);
stdout.write(",");
stdout.write(f2);
stdout.write(",");

while(num-2 != 0){
f3 = f1+f2;
num--;

stdout.write(f3);
stdout.write(",");
f1 = f2;
f2 = f3;
}
}
void main() {
print('Please enter a number:');
int fibnum = int.parse(stdin.readLineSync().toString());
fibonacci(fibnum);
}
Binary file added Assignments/Session 1/q1_ss.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Assignments/Session 1/q2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'dart:io';

void check(int n){
int count = 0;

for (int i=2;count<2&&i*i<=n;++i){
while(n%i==0){
n~/=i;
count++;
}
}

if(n>1)
count++;

if(count==2)
print ('It is a semi-prime');
else
print ('It is not a semi-prime');

}

void main() {
int n;
print('Enter a number:');
n=int.parse(stdin.readLineSync().toString());
check(n);
}
Binary file added Assignments/Session 1/q2_ss.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions Assignments/Session 1/q3.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'dart:io';

bool checkPrime(int num){

for(int i = 2;i<=num~/2;i++){
if(num%i == 0){
return false;
}
}

return true;
}


void checkarr(List<int> list){
int sum=0;

for (int i = 0; i < list.length; i++) {
if (checkPrime(list[i])&&list[i]!=1)
sum += list[i];
}

print(sum);

if(checkPrime(sum))
print('The sum of prime elements is prime');
else
print('The sum of prime elements is not prime');

}

void main() {
var list = <int>[];
print("Enter the number of elements");
int n = int.parse(stdin.readLineSync()!);

print("Enter an array: ");

for (int i = 0; i < n; i++)
list.add(int.parse(stdin.readLineSync()!));

checkarr(list);

}
Binary file added Assignments/Session 1/q3_ss.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions Assignments/Session 1/q4.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import 'dart:io';

class OpenElective {
String courseName;
String courseCode;

OpenElective(this.courseName,this.courseCode);
}

class BranchElective extends OpenElective{
int year;
String branch;

BranchElective(this.branch, this.year, courseName, courseCode) : super(courseName, courseCode);
}


void main() {

List<OpenElective> oel = [];
List<BranchElective> bel = [];

while (true) {
print('Are you a 1.Admin 2.Student 3.Exit');
int opt=int.parse(stdin.readLineSync().toString());

switch (opt) {
case 1:{
print('Which course do you want to add 1.Open Elective 2. Branch Elective');
int opt1=int.parse(stdin.readLineSync().toString());

switch (opt1) {
case 1:{
print("Enter the course name and course code:");
String n = stdin.readLineSync().toString();
String c = stdin.readLineSync().toString();
oel.add(OpenElective(n,c));
print('Added successfully');
break;
}
case 2:{
print("Enter the branch, year, course name and course code");
String bn = stdin.readLineSync().toString();
int y = int.parse(stdin.readLineSync().toString());
String n = stdin.readLineSync().toString();
String c = stdin.readLineSync().toString();
bel.add(BranchElective(bn,y,n,c));
print('Added successfully');
break;
}
}
}
break;

case 2:{
print("Enter your branch and year");
String bn = stdin.readLineSync().toString();
int y= int.parse(stdin.readLineSync().toString());

print("List of Open Electives:");
oel.forEach((element) {print("${element.courseName} ${element.courseCode}");});

print("List of Branch Electives:");
bel.forEach((element) {
if(element.branch == bn&& element.year == y){
print("${element.courseName} ${element.courseCode}");
}
});
}
break;

case 3:{
exit(0);
}
}
}
}
Binary file added Assignments/Session 1/q4_ss.jpg
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 Assignments/Session 2-Number Trivia App/.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 Assignments/Session 2-Number Trivia App/.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
9 changes: 9 additions & 0 deletions Assignments/Session 2-Number Trivia App/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Number Trivia App

Demo:


https://user-images.githubusercontent.com/84085307/150076894-dd9d9a94-e249-428f-9066-9e2796bfdb99.mp4



29 changes: 29 additions & 0 deletions Assignments/Session 2-Number Trivia App/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions Assignments/Session 2-Number Trivia App/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
69 changes: 69 additions & 0 deletions Assignments/Session 2-Number Trivia App/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.numapi_iris_bootcamp"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
crunchPngs false
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.numapi_iris_bootcamp">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Loading