Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Faculty of Computer and Mathematical Sciences are going to organize an ICT Festival. The festival consists of exhibitions of ICT products from the
The Faculty of Computer and Mathematical Sciences are going to organize an ICT Festival. The festival consists of exhibitions of ICT products from the government and private sectors. Meanwhile, for ICT competition during the festivals: there will be two categories of ages which are junior and senior. Given the following superclass named ICTFestival and subclasses named Exhibitor and Contestant: public abstract class ICTFestival { } protected String participant Name; protected int participantID; // 1-250 protected String email; } //normal constructor //setter methods //getter methods public String toString() public abstract double enrollFee (); public class Exhibitor extends ICTFestival { private char sector; // G for government, P for private private int noOfBooth; //normal constructor //setter method //getter public String toString() public double enrollFee () {...} public class Contestant extends ICTFestival { private int level; private int members; //normal constructor //setter method // 1 for junior, 2 for senior //getter public String toString() public double enrollFee () {...} a. Write the definition of method enrollFee() for both subclasses that calculate and return the enrollment fee using the following information: For Exhibitors, the enrollment fee will be calculated as shown in Table 1. Table 1 Sector G (Government sector) P (Private sector) For Contestants, the enrollment fee will be calculated as shown in Table 2. Level Level 1 (Junior) Level 2 (Senior) Enrollment Fee (RM) 250 (1 booth) additional RM 50 per booth 300 (1 booth) additional RM 100 per booth Table 2 Enrollment Fee (RM) 100 additional RM 50 for extra member 150 additional RM 100 for extra member (8 marks) b. Declare an array of type ICTFestival named participants with size 250. (1 mark) c. Assume 250 objects of Exhibitor and Contestant are stored inside the array in b). Using the array, write program fragments for the following questions. i. Calculate and display the total number of booth for Private Sector Exhibitors. (3 marks) ii. Print the participant name and enrollment fee for participants from UiTM. (Check the email of the participants whether it contains "@uitm.edu.my using indexOf()). (3 marks)
Step by Step Solution
★★★★★
3.47 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
a Definition of method enrollFee for both subclasses Exhibitor and Contestant java public double enr...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started