Lab 01
Lab 01
1
Lab01 Exercises
❖ Lab01.3. Asterisks
Write a program in Java to display shapes as below:
Console Output:
A B C
❖ Lab01.4. Table
Write a program in Java to display tables as below with values declared by variables:
A B
2
Lab01 Exercises
❖ Lab01.5. String
A. Write a program using a String function to print/check the length of a text “I Love My Hometown”:
Console Output:
Text length is: 22
B. Write a program using a String function to cut the word “my little country” from a text of “I love my little country”:
Console Output:
Result: my little country
C. Write a program using a String function to find the index position of vowels in a text of “Hi Students!”:
Console Output:
“i” is at index: 1
“u” is at index: 5
“e” is at index: 7
3
Lab01 Exercises
D. Write a program using a String function check if two texts are equal
Console Output:
Text1 is equal to Text2: False
Text1 is equal to Text3: True
E. Write a program using a String function check if a text contains in another text
Console Output:
Text1 contains Text2: True
Text1 contains Text3: False
4
Lab01 Exercises
❖ Lab01.6. Class & Object
2. Create objects from “Student” class
Create a model following objects:
▪ Employee Object 1 Object 2
▪ Car Variable Value Variable Value
▪ BankAccount studentID 0002 studentID 0001
▪ Video
name Makara name Tola
gender F gender M
1. Implement a class model with at least 5 different attributes
2. Create at least 2 objects with values assigned age 17 age 15
3. Implement a Java Class based on the model score 88.3 score 98.3
year 4 year 3
5
Good luck 👌
👉 Screenshot/Save all your answers as a single pdf file, Java files and submit to the class
6