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

Problem 6: (20 pts) Create two subclasses called outpatient and inpatient which inherit from the patient...
Problem 6: (20 pts) 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.
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...
Create a generic superclass Shoe, which has at least 3 subclasses with attributes as shown below:...
Create a generic superclass Shoe, which has at least 3 subclasses with attributes as shown below: class Shoe: Attributes: self.color, self.brand class Converse (Shoe): # Inherits from Shoe Attributes: self.lowOrHighTop, self.tongueColor, self.brand = "Converse" class CombatBoot (Shoe): # Inherits from Shoe Attributes: self.militaryBranch, self.DesertOrJungle class Sandal (Shoe): # Inherits from Shoe Attributes: self.openOrClosedToe, self.waterproof Implement the classes in Python. Create a separate test module where 2 instances of each subclass are created. Test the methods by displaying their information.
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)...
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...
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...
C++ Question1. Create a class called Rantional for performing arithmatic with fractions. Then write a program...
C++ Question1. Create a class called Rantional for performing arithmatic with fractions. Then write a program to test your class. Use integer variables to represent the private data of the class, meaning the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it's declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form. For example fraction 2/4 would be stored...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT