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

Barba Act1 #2

Open
wants to merge 1 commit 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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/students.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 11 additions & 20 deletions activities/activity1/main.dart
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
import 'dart:io';

void main() {
Person p1 = Person('Jane','Alba', 25);
print(p1.getFullName());
print(Person.getInfo());
Person p2 = Person.withLNandAgeOnly('Villaruel', 23);
print(p2.getFullName());

print("Enter First Name: ");
String fn = stdin.readLineSync();
print("Enter Middle Name: ");
String mn = stdin.readLineSync();
print("Enter Last Name: ");
String ln = stdin.readLineSync();
print("Enter Age: ");
String strAge = stdin.readLineSync();
int age = int.parse(strAge);
Person p3 = Person(fn,ln,age);
print(p3.getFullName());
Student p = Student(fn, mn, ln, age);
print(p.getFullName());
}

class Person {
static String company = 'ABC Company';
String firstName, lastName;
class Student {
static String department = 'Computer Science';
String firstName, lastName, middleName;
int age = 18;
String _dept;

String get dept => _dept;

Person(this.firstName, this.lastName, this.age);
Student(this.firstName, this.middleName, this.lastName, this.age);

//named constructor
Person.withLNandAgeOnly(this.lastName, this.age);
Student.withLNandAgeOnly(this.lastName, this.age);

//Person p = Person();
//p.getFullName();
String getFullName() {
return ("$firstName $lastName age is $age");
return ("Hello $firstName $middleName $lastName, $age, from $department department");
}

//Person.getInfo()
static String getInfo() {
return 'This is a Person class';
}

//
@override
String toString() {
Expand All @@ -51,4 +42,4 @@ class Person {
void setLastName(String lastName) {
this.lastName = lastName;
}
}
}