Question

In: Computer Science

-------------- WRITE IN C# ------------------- Create two subclasses called outpatient and inpatient which inherit from the...

-------------- WRITE IN C# -------------------

Create two subclasses called outpatient and inpatient which inherit from the patient base class. The outpatient class has an additional data field called doctorOfficeID and the inpatient class has an additional data item called hospitalID. Write a main method that creates inpatient and outpatient objects. Sets data for these objects and display the data.

Solutions

Expert Solution

  1. using System;  
  2.    public class Patient
  3.     {  
  4.        string name;
  5. int age;
  6.    } //base class
  7.    public class Inpatient: Patient //inpatient sub-class
  8.    {  
  9.        float hospitalID;
  10. public void Inpatient(float x)
  11. {
  12. hospitalID=x;
  13. }
  14. void display()
  15. {
  16. Console.WriteLine("hospitalID:"+hospitalID);
  17. }
  18.    }
  19. public class Outpatient : Patient //outpatient-subclass
  20. {
  21. float doctorOfficeID;
  22. public void Outpatient(float x)
  23. {
  24. doctorOfficeID=x;
  25. }
  26. void display()
  27. {
  28. Console.WriteLine("doctorID:"+doctorOfficeID);
  29. }
  30. }
  31.    class PatientInheritance{  
  32.        public static void Main(string[] args) //main method
  33.         {  
  34.             Inpatient ip=new Inpatient(5005);
  35. Outpatient op=new Outpatient(1505);
  36.   
  37. ip.display();
  38. op.display();
  39.   
  40.         }  
  41.     }

Related Solutions

Write TWO scenarios-one for an inpatient and one for an outpatient-on scheduling a procedure. You must...
Write TWO scenarios-one for an inpatient and one for an outpatient-on scheduling a procedure. You must select an appropriate procedure for an inpatient and an appropriate procedure for an outpatient. An inpatient procedure is one that requires hospitalization, at least overnight. With an outpatient procedure, the patient returns home the same day. It may be performed in the physician office, a clinic, or a hospital facility. You may write an essay or use a table to describe the following for...
Write C code to create a structure called time_of_day, which stores the current time in hours,...
Write C code to create a structure called time_of_day, which stores the current time in hours, minutes, and seconds. All the fields should be integers except for seconds, which should be a floating point value. Write a C function called check_time, which takes a pointer to a time_of_day structure as input, and return 1 if the time is valid (0 to 23 hours, 0 to 59 minutes, 0 to 59.999999 seconds) and 0 otherwise. Assume that times are stored in...
C++ HW Aim of the assignment is to write classes. Create a class called Student. This...
C++ HW Aim of the assignment is to write classes. Create a class called Student. This class should contain information of a single student. last name, first name, credits, gpa, date of birth, matriculation date, ** you need accessor and mutator functions. You need a constructor that initializes a student by accepting all parameters. You need a default constructor that initializes everything to default values. write the entire program.
Write a C++ program in a file called pop.cpp that opens a file called pop.dat which...
Write a C++ program in a file called pop.cpp that opens a file called pop.dat which has the following data (you’ll have to create pop.dat) AX013 1.0 BX123456 1234.56 ABNB9876152345 99999.99 The data are account numbers and balances. Account numbers are, at most 14 characters. Balances are, at most, 8 characters (no more than 99999.99). Using a loop until the end of file, read an account number and balance then write these to standard output in the following format shown...
Need to create a program in C++ that can display/write into a file called marks.txt. I'm...
Need to create a program in C++ that can display/write into a file called marks.txt. I'm not too worried about the functions, but I don't know how to store the different marks into a arrays. Any help would be appreaciated. Here's some details about the assignment. Student marks are kept in a text file as a single column. Each student may have a different number of assessments and therefore scores. The data recorded in the file for each student start...
Needed in C++ In this assignment, you are asked to create a class called Account, which...
Needed in C++ In this assignment, you are asked to create a class called Account, which models a bank account. The requirement of the account class is as follows (1) It contains two data members: accountNumber and balance, which maintains the current account name and balance, respectively. (1) It contains three functions: functions credit() and debit(), which adds or subtracts the given amount from the balance, respectively. The debit() function shall print ”amount withdrawn exceeds the current balance!” if the...
Create a C# Application. Create a class object called “Employee” which includes the following private variables:...
Create a C# Application. Create a class object called “Employee” which includes the following private variables: firstN lastN idNum wage: holds how much the person makes per hour weekHrsWkd: holds how many total hours the person worked each week regHrsAmt: initialize to a fixed amount of 40 using constructor. regPay otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods: constructor properties CalcPay(): Calculate the regular pay and overtime pay. Create...
1) "Data Collection," identifies which four categories of quality measurement? Select one: a. Inpatient, outpatient, long-term...
1) "Data Collection," identifies which four categories of quality measurement? Select one: a. Inpatient, outpatient, long-term care, and hospice b. Clinical, quality, financial performance, patient/physician/staff satisfaction, and functional status c. Clinical, administrative, community benefit, and patient engagement d. Patient level, microsystem level, macrosystem level, and environmental level 2) Which of the following is a consideration in data collection? Select one: a. Time of data collection b. Cost of data collection c. Inpatient versus outpatient d. All of the above 3)...
1. when you create a class by making it inherit from another class, the new class...
1. when you create a class by making it inherit from another class, the new class automatically, contains the data fields and _____ of the original class a. fonts b. methods c. class names d. arrays 2. if a programming language does not support ________, the language is not considered object oriented a. syntax b. applets c. loops d. polymorphism 3. when you create a class and do not provide a ______, java automatically supplies you with a default one...
Write a C++ programs to: 1. Create a class called Student with four (4) private member...
Write a C++ programs to: 1. Create a class called Student with four (4) private member variables, name (string), quiz, midterm, final (all double type); 2. Include all necessary member functions for this class (at least 1 constructor, 1 get function, and 1 grading function – see #6); 3. Declare three (3) objects of Student type (individual or array); 4. Read from the keyboard three (3) sets of values of name, quiz, midterm, final and assign them to each object;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT