Assignment 1
Assignment 1
Assignment 1
Student Name
Matric Number
Administrative Procedure
__________________________________ _________________________________
Name: SURIATI JAMALLUDIN Name:
Date : 5/5/2024 Date :
/50
MEMBERS NAME & MATRIC NO:
Page 2
Complete ALL tasks in group of TWO.
TASK 1
Write a Java Program to create array of objects for THREE (3) passengers to book a
bus PERMATA ticket. You are required to:
Page 3
TASK 2
Write a Java program to create a class called `Animal` with two attributes: `name` and
`type`. The `Animal` class should have a `makeSound()` method. Create two child classes
of the `Animal` class: `Kambing` and `Kucing`. The `Kambing` class should override the
`makeSound()` method to print "Embekk!". The `Kucing` class should override the
`makeSound()` method to print "Meow!". In the main method, create an instance of each
child class and call the `makeSound()` method on each instance.
Page 4