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)
-
Brett Stenback is evaluating a business opportunity to sell grooming kits at dog shows. Brett can buy the grooming kits at a wholesale cost of $37 per set. He plans to sell the grooming kits for $70...
-
List and explain five deceptive marketing practices, and explain how they are treated differently from offences against competition.
-
An exhaust fan, having a small unbalance, weights \(800 \mathrm{~N}\) and operates at a speed of \(600 \mathrm{rpm}\). It is desired to limit the response to a transmissibility of 2.5 as the fan...
-
In February 2014, Storage Company worked on five job orders for specialty cedar storage cabinets. It began Job Z-6 for Cedar Safe, Inc., on February 10 and completed it on February 24. Partial data...
-
Have you seen this month's inflation numbers? Each time new numbers are released, the words inflation and inflation rate receive attention and trend in the news. Inflation is a general, sustained...
-
Financial statement data of ABC Fencing, Inc. include the following items: Cash .................... $ 21,000 Short-Term Investments .......... 25,000 Accounts Receivable, Net .......... 102,000...
-
Patients scheduled to see their primary care physician at a particular hospital wait, on average, an additional nine minutes after their appointment is scheduled to start. Assume the time that...
-
What are minimum acceptable discharge criteria, hose stream allowances, and water supply durations for the protection of the following facility using either CMDA sprinklers or K11.2 upright CMSA...
-
4. A water tank with the following dimensions is draining. L ho 1 V L = (1+x) m 1 = 1m a = 5cm b = 5cm g = 9.81 m/s ho = (80+ x*)cm b a x* is in cm a- What are the essential steps to build a...
-
Find the distance between the main spring and the secondary spring. use the work-energy method:
-
Make a financial forecast for a new company like amazon for the year 2024 and 2025 Your financial forecasts should include: Cash flow statements - cash balance and the cash flow pattern Some other...
-
A. 1. Select two companies in the same or similar industries 2. Go to SEC Edgar and find their most recent 10K (or the company's website under "Investor Relations", SEC Filings and search "annual"...
-
A study in Ahmedabad found that out of 15,00,000 workers in the city, 11,00,000 worked in the unorganised sector. The total income of the city in this year (1997-1998) was Rs 60,000 million. Out of...
-
Four GWU students have been selected to taste food sold by 3 different food trucks labeled as food truck A, B and C on H & 22nd Streets every Monday for 3-weeks. For each student, food trucks are...
-
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...
-
An analysis by Professor Peter M Rothwell and his colleagues (Nuffield Department of Clinical Neuroscience, University of Oxford, UK) published in 2012 in the medical journal The Lancet...
-
Suppose a student is interested in knowing the preferred holiday destinations of the faculty members in their university. They are affiliated to the college of business and interview a few of the...
-
The following table shows the result of the 2018 General Elections in Pakistan, along with the vote share predicted by several organizations in the days before the elections. The sample sizes were...
Study smarter with the SolutionInn App