Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
* *******
** ******
*** and *****
**** ****
***** ***
****** **
******* *
3. Define a program similar to in assignment 2 above which will display user
specified characters from command line in the Rangolis instead of ‘*’
character.i.e.
CCCCCC
CCCCC
CCCC
CCC
CC
C
and ?
??
???
????
?????
??????
4. Define a class named 'myClass' and having following variables and
methods
Variables:
shared Name string type
integer Num
Constructor:
Define the constructor to initialize Num and Name variables to specified
values.
shared methods
setName (String newName) to assign newName to Name variable
Instance method
getName to return the value of Name variable and print the "GetName"
message.
Define two properties as ‘id’ and ‘balance’ and provide set/get methods.
Define the test program to create the instances of 'myClass' and assign
different values to its properties and print them.
5. Define a program to demonstrate type casting/conversion from string to byte,
short, long and int parameters use implicit and explicit casting provide type
casting to double and float parameters by giving higher and smaller range
values and print the values before and after conversions.
6. Define a class to print a message when the class objects are destroyed by
the garbage-collector. (i.e. Provide finalize ( ) method.) In main ( ) create
objects and call garbage collector to destroy the objects
7. Define an Account class with parameters as int no, string type double balance
Define different overloaded constructors and call the other constructors in
overloaded constructors. Print the messages in respective constructors.
8. Define a class ‘Shape’ with different methods with same name ‘DrawShape’
but with different set of parameters. Define these overloaded methods and
demonstrate their use in main ( ) method. Use method overloading.
9. Define a ‘Base’ class with variables int acc_no, string Br_name;
Define the method as
Public sub SetNumber (integer no)
this.acc_no=no;
End sub
integer t= acc_no;
return t;
End sub
in main( ) method of child class create objects of base and child classes
and assign values to these objects call the respective methods using
these objects and print their messages And values.
10. Create 2 base classes namely Account and Person (Account class will have
the properties for AccountId, Type, Balance and Person will have FirstName,
LastName and Address)
• Create derived classes deriving from the base classes namely
SavingAccount (base Account), BankCustomer (base Person)
****************