Given the following superclass named Hospital and subclasses named Inpatient and Outpatient. Abstract Superclass: Hospital Attributes:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given the following superclass named Hospital and subclasses named Inpatient and Outpatient. Abstract Superclass: Hospital Attributes: Methods: String name String gender int age // patient's name patient's gender (male or female) // patient's age in year constructor, mutator, accessor, printer, abstract method abstract double caleCharges () // calculate the charges Subclass: Attributes: Methods: Inpatient int wardType; int day; double treatment Fee; // ward type // number of days stay // treatment charges constructor, mutator, accessor, printer Subclass: Outpatient Attributes: double Methods: consultationFee double medicineFee String consultationDate // consultation fee // medicine fee // (dd/mm/yyyy) // e.g 15/10/2018 constructor, mutator, accessor, printer a) Write the normal constructor for Inpatient and Outpatient classes. b) Write a method calcCharge () for both subclasses to calculate the charge to be paid by the patients of the hospital. For senior citizens, they are entitle to get 50% discount for the charges. The patients are considered as senior citizens when their ages are greater than 60 years old. The daily ward charges for inpatients are shown in the following table: Ward Type 1 (1-bed) Charges (RM) /day 350 2 (2-bed) 250 4 (4-bed) 100 The charge for inpatients is calculated based on the given formula: Charges ward charges + treatment fee For outpatients, they only have to pay for consultation and medicine fees. c) Write program fragments that use the concept of polymorphism to perform the following: i) Declare an array of objects to store 100 patients. ii) Display the detail of female inpatients that have been admitted to the hospital. iii) Count and display the inpatient's details who have been admitted in the hospital for more than 10 days. iv) Calculate and display the total charges of all outpatients in the month of October 2018 Given the following superclass named Hospital and subclasses named Inpatient and Outpatient. Abstract Superclass: Hospital Attributes: Methods: String name String gender int age // patient's name patient's gender (male or female) // patient's age in year constructor, mutator, accessor, printer, abstract method abstract double caleCharges () // calculate the charges Subclass: Attributes: Methods: Inpatient int wardType; int day; double treatment Fee; // ward type // number of days stay // treatment charges constructor, mutator, accessor, printer Subclass: Outpatient Attributes: double Methods: consultationFee double medicineFee String consultationDate // consultation fee // medicine fee // (dd/mm/yyyy) // e.g 15/10/2018 constructor, mutator, accessor, printer a) Write the normal constructor for Inpatient and Outpatient classes. b) Write a method calcCharge () for both subclasses to calculate the charge to be paid by the patients of the hospital. For senior citizens, they are entitle to get 50% discount for the charges. The patients are considered as senior citizens when their ages are greater than 60 years old. The daily ward charges for inpatients are shown in the following table: Ward Type 1 (1-bed) Charges (RM) /day 350 2 (2-bed) 250 4 (4-bed) 100 The charge for inpatients is calculated based on the given formula: Charges ward charges + treatment fee For outpatients, they only have to pay for consultation and medicine fees. c) Write program fragments that use the concept of polymorphism to perform the following: i) Declare an array of objects to store 100 patients. ii) Display the detail of female inpatients that have been admitted to the hospital. iii) Count and display the inpatient's details who have been admitted in the hospital for more than 10 days. iv) Calculate and display the total charges of all outpatients in the month of October 2018
Expert Answer:
Related Book For
Accounting for Decision Making and Control
ISBN: 978-0078025747
8th edition
Authors: Jerold Zimmerman
Posted Date:
Students also viewed these databases questions
-
Your marketing team has started the analysis of your company's marketing environment. Competition has been very intense in recent years in your industry, so you decide to place more emphasis on...
-
lim 2sin 71-00 2019 n n+1 + cos 2019 n n+1 is equal to (Answer should be integer)
-
Behr Manufacturing manufactures 16 GB fl ash drives (jump drives). Price and cost data for a relevant range extending to 200,000 units per month are as follows: Sales price per unit (current monthly...
-
A function is defined by f(x) = Ax + 5/6x - 2 If f(1) = 4, find A.
-
Linda Budd went searching for a new friend and she found one for \($400.1\) A brand new puppy. She purchased the puppy from Bernadette Vicidomine, a person who regularly sells puppies. Budd took her...
-
Fred and Sally Merrit recently inherited a substantial amount of money from a deceased relative. They want to use part of this money to establish an account to pay for their daughters college...
-
Mary, Shannon, and Anika invested $60,000, $75,000, and $105,000, respectively, to start an e-learning business. They realized that they required an additional $22,800 for operating the business. How...
-
The given p - v diagram (not to scale) shows a closed system undergoing a power cycle using water. The cycle comprises of four sequential processes. The Process 1-2 and Process 3-4 are isobaric,...
-
What are the main disclosure requirements of IAS 12 with regard to the effective rate of tax on profits?
-
The minimum wage alters each year. Find out how much the minimum wage actually is at the present time. How much is the rate for adults aged 21 or over? How much is the rate for those aged 1820? What...
-
Its always nice when someone gives you a gift. Over the past few years, more people have been showing their appreciation by giving gift cards, often prepaid plastic cards issued by a retailer that...
-
Discuss the issues of definition and measurement raised by fair value accounting.
-
Why has there been a strong campaign for more open country-by-country reporting?
-
Find where the graphs of y = 3x and y = ex intersect by finding roots of ex 3x = 0 correct four decimal digits.
-
Why is inventory management important for merchandising and manufacturing firms and what are the main tradeoffs for firms in managing their inventory?
-
Taylor designs and manufactures high- performance bicycle chains for professional racers and serious amateurs. Two new titanium chain sets, the Challenger and the Tour, sell for ¬ 110 and ¬...
-
Ive given a good deal of thought to this issue of how companies . . . go about negotiating object tives with their different business units. The typical process in such cases is that once the parent...
-
Golf World is a 1,000- room luxury resort with swimming pools, tennis courts, three golf courses, and many other resort amenities. The head golf course superintendent, Sandy Green, is responsible for...
-
Draw Bode plots for a sixth-order Pade approximation to a pure delay of 1 second.
-
A rejection network that can be utilised instead of the twin-T network is the bridged-T network shown below. The transfer function of this network is given by \[...
-
Sketch the polar plot of the frequency response for the following transfer functions: 1 (a) KG(s): = (1+0.5s) (1+2s) (1+0.5s) (b) KG(s) = $2 s+10 (c) KG(s) = s2+6s+10 30(s+8) (d) KG(s) = s(s+2)(s+4)
Study smarter with the SolutionInn App