Professional Documents
Culture Documents
Per Assignment 2
Per Assignment 2
1) Write a Dart program that defines a Student class with fields name and grade. Include
a method displayInfo() that prints the student's name and grade. Create an instance
of the Student class in the main() function and use it to set the student's name and
grade, then call the displayInfo() method to print the information.
Output
2) Write a Dart program that uses the BankAccount class to perform a sequence of
deposits and withdrawals. Initialize the account with a balance of 500, deposit 300,
withdraw 100, and then print the final balance.
Output
3) Write a Dart program that defines a Bird class that extends the Animal class. Override
the speak() method in the Bird class to print "Bird chirps". In the main() function,
create instances of Dog, Cat, and Bird, assign them to a variable of type Animal, and
call their speak() methods..
Output