Makcik Minah has opened a new children art class. During the Registration Day, 30 children have registered. Makcik Minah’s assistant, Munah has manually obtained information from the children that include name, birth certification number, date of birth and gender. All these information is required in order to divide the students into classes. There are 3 classes in Makcik Minah’s kindergarten; Red – for children that are 4 years old, Green – for children that are 5 years old and Blue - for children that is 6 years old. To ensure the data is properly kept, Makcik Minah and Munah hire you to develop a system that will read the data, categorised the students into the 3 classes and print (to a file) a name list that will assist the children on class they are placed. An example of the students’ name list is as shown in Figure 1.

Class: Red
no. name birth cert no gender
1. ravin 333333 M
2. shanti 666666 F
3. eric 101010 M

no. name birth cert no gender
1. chan 222222 M
2. leong 555555 F
3. tan 888888 F

no. name birth cert no gender
1. adibah 111111 F
2. ali 4444 M
3. abu 777777 M
4. raju 999999 M

Figure 1

Your program should have:
1. Input validation (validate all input – check whether the user is entering values that are within range).
2. Array
3. User defined data type.

6 Years
Discussion Span
Last Post by packetpirate

create temp variables for the name, certificate no and sex, birth date etc.

Then create a class with all these members. then create three array objects for the class with names : red, green and blue.

Get input one by one and check the birth data and put the students data in the corresponding object array. Sort them according to name.
Then print them to file in required format.

If u follow above method, u will have input validation, array and user defined data type i.e class.

Its as simple as that!

Happy Coding!!!


Why is it that people can never just do their homework on their own? You're not learning anything by having others do the work for you.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.