Question

In: Computer Science

NEED ASAP PLEASE IF THIS CANNOT BE ANSWERED WITHIN 1 HOUR TO 1.5 HOURS MAX PLEASE...

NEED ASAP PLEASE IF THIS CANNOT BE ANSWERED WITHIN 1 HOUR TO 1.5 HOURS MAX PLEASE DO NOT DO

I DON'T NEED PROBLEMS 1-4 PLEASE ANSWER 5-7 ONLY. ONLY LISTED 1-4 AS A REFERENCE.

This should be in

Type of application :Console application

Language used :C#

Program.cs :

Problem 1:

(15 pts)

Write a C# console program that continually asks the user "Do you want

to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters

either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and

then get keyboard input of the name. After entering the name, display the name to the screen.

Problem 2:

(20 pts) Create a Patient class which has private fields for patientid, lastname,

firstname, age, and email. Create public properties for each of these private fields with get and

set methods. The entire lastname must be stored in uppercase. Create a main class which

instantiates a patient object and sets values for each data item within the class. Display the

data in the object to the console window.

Problem 3:

(15 pts) Modify the Patient class with two overloaded constructors: A new default

constructor which initializes the data items for a patient object using code within the

constructor (use any data). A second constructor with parameters to pass all the data items

into the object at the time of instantiation. Create a test main class which instantiates two

objects. Instantiate the first object using the default constructor and the second object using

the constructor with the parameters.

Problem 4:

(10 pts) Add a static display method in the main class in the patient application

that has a parameter to pass a patient object and display its content.

Problem 5:

(10 pts) Modify the patient class with two overloaded methods to display a bill for a

standard visit based on age. In the first method do not use any parameters to pass in data. If

the patient is over 65, then a standard visit is $75. If the patient is under 65, then the standard

doctors office visit is $125. Build a second method where you pass in a discount rate. If the

patient is over 65, then apply the discount rate to a standard rate of $125. Create a main

method that calls both of these methods and displays the results.

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.

Problem 7:

( 10 pts) Modify the base class of Problem 6 to be an abstract class with an abstract

display method called displayPatient that does not implement any code. Create specific

implementations for this method in both the outpatient and inpatient subclasses.

Solutions

Expert Solution

QUES: 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.

SOLUTION IN C++

#include <iostream>
#include <conio.h>
using namespace std;
class patient
{ char firstname[100];
 char lastname[100];    // varibles declration of patient class
  char email_id[100];
    int patientid;
    public:
        void getdata()
        {
            cout<<"FirstName: ";
            
            cin>>firstname;
            cout<<"lastName: ";
            cin>>lastname;
            cout<<"email id: ";
            
            cin>>email_id;
            cout<<"patientid ";
            cin>>patientid;
            
        }
        void setdata()
        {
            cout<<"firstname: "<<firstname<<endl;
            cout<<"lastname "<<lastname<<endl;
            cout<<"email_id "<<email_id<<endl;
        }
};
class outpatient: public patient
{
    int doctorOfficeID;
   
    public:
        void getdata()
        {
            patient::getdata();   //get method of patient
           
            cout<<"doctorOfficeID.";
            cin>>doctorOfficeID;
        }
        void setdata()
        {
            patient::setdata();   //set method of patient
            
            cout<<"doctorOfficeID."<<doctorOfficeID<<endl;   
                          }
};
class inpatient: public patient
{
    int hospitalID;
    public:
        void getdata()
        {
            patient::getdata();    //get method of patient
            cout<<"hospitalID ";
            cin>>hospitalID;
        }
        void setdata()
        {
            patient::setdata();    //set method of patient
            cout<<"hospitalID "<<hospitalID;
        }
};

        int main()
{
    outpatient s;   //need two objects because there are two derived classes
    inpatient e;
    cout<<"////////////////outpatient details///////////////"<<endl;
    cout<<"Enter data"<<endl;
    s.getdata();
    cout<<endl<<"Displaying data"<<endl;
    s.setdata();
    
        
        cout<<endl<<"/////////////inpatient details///////////////"<<endl;
    cout<<"Enter data"<<endl;
    e.getdata();
    cout<<endl<<"Displaying data"<<endl;
    e.setdata();
    
    return 0;
}

    

OUTPUT :Ques:  

Modify the patient class with two overloaded methods to display a bill for a

standard visit based on age. In the first method do not use any parameters to pass in data. If

the patient is over 65, then a standard visit is $75. If the patient is under 65, then the standard

doctors office visit is $125. Build a second method where you pass in a discount rate. If the

patient is over 65, then apply the discount rate to a standard rate of $125. Create a main

method that calls both of these methods and displays the results.

Solution:

#include <iostream>
using namespace std;
 
class patient {
        int age;
        
        
   public:
         
      void bill() 
          {
                
                int x=75,y=125;
                cout<<" enter the age of patient";
             cin>>age;
                
                if (age>65)
                {
                  
        cout << "standard rate is " << "$"<<x << endl;
        }
        else
        {
                cout<<" standard doctors office visit  for patient"<<"$"<<y<<endl;
      }}
      void bill(int dis) {
        
        if(age>65)
        cout<<"discount"<<"$"<<dis<<endl;
        
      }
      
};

int main() 
{
        
   patient pd;   //object of patient
  
 
   // Call bill method
   pd.bill();
   
   // Call bill method passing argument
   pd.bill(125);
   
   return 0;
}

Output:


Related Solutions

I need this answered within a few hours preferably for the language of english and christianity,...
I need this answered within a few hours preferably for the language of english and christianity, but it could be on different language and religions diffusion throughout the world. Cultural diffusion is the spread of a culture’s charcteristics such as activities and beliefs, from one culture to another.What causes cultural diffusion? Describe the distribution of one global language and one global religion. Identify the hearth regions for these traits and explain how they diffused to their present locations. Be sure...
Please answer within 1 hour. This is my last question and its due in 1 hour!!...
Please answer within 1 hour. This is my last question and its due in 1 hour!! :( What atomic or hybrid orbitals make up the sigma bond between C2 and Cl in dichloroethylene, CH2CCl2? (C2 is the second carbon in the structure as written.) ________ orbital on C2+_________orbital on Cl What is the approximate C1-C2-Cl bond angle?________
An employee earns $16 per hour and 1.5 times that rate for all hours in excess...
An employee earns $16 per hour and 1.5 times that rate for all hours in excess of 40 hours per week. Assume that the employee worked 55 hours during the week. Assume that the social security tax rate was 6.0%, the Medicare tax rate was 1.5%, and federal income tax to be withheld was $230.00. a. Determine the gross pay for the week. $ If applicable, round your final answer to two decimal places. b. Determine the net pay for...
Calculate Payroll An employee earns $30 per hour and 1.5 times that rate for all hours...
Calculate Payroll An employee earns $30 per hour and 1.5 times that rate for all hours in excess of 40 hours per week. If the employee worked 54 hours during the week. Assume that the social security tax rate is 6.0%, the Medicare tax rate is 1.5%, and the employee's federal income tax withheld is $295.a. Determine the employee's gross pay for the week. b. Determine the employee's net pay for the week. Round your answer to two decimal places.
Calculate Payroll An employee earns $40 per hour and 1.5 times that rate for all hours...
Calculate Payroll An employee earns $40 per hour and 1.5 times that rate for all hours in excess of 40 hours per week. Assume that the employee worked 55 hours during the week, and that the gross pay prior to the current week totaled $58,000. Assume further that the social security tax rate was 6.0%, the Medicare tax rate was 1.5%, and federal income tax to be withheld was $575. a. Determine the gross pay for the week. $ If...
I need to have this done within 1 hour and a half. Thank YOU!:) 17. Minnesota...
I need to have this done within 1 hour and a half. Thank YOU!:) 17. Minnesota Department of Health wants to test the claim that variability in COVID-19 within Minnesota is greater than 12.75. For this, they took a sample of 25 days data and found that the mean is 215 and standard deviation was 14.17. At alpha=5% what will be the decision?   Question 17 options: Reject H0 at alpha =5% Do not reject H0 at alpha=5% We do not...
12. The per-unit standards for direct labor are 1.5 direct labor hours at $15 per hour....
12. The per-unit standards for direct labor are 1.5 direct labor hours at $15 per hour. If in producing 3400 units, the actual direct labor cost was $69750 for 4500 direct labor hours worked, the total direct labor variance is $2250 unfavorable. $6750 unfavorable. $6750 favorable. $3400 unfavorable. 13. A company purchases 10000 pounds of materials. The materials price variance is $7000 favorable. What is the difference between the standard and actual price paid for the materials? $1.43 $0.70 $7.00...
i need a conclusion for my paper on ADHD. I need this asap please have to...
i need a conclusion for my paper on ADHD. I need this asap please have to turn my paper in one hour!!!! thank you            In the recent times, ADHD is being seen in the light of cerebral dysfunction with too much focus on clinical treatment using medication at the same time keeping psychotherapy at bay which shows a dangerous trend. Psychotherapy even though cannot explain the cause of the condition, but it can help the children in coping his...
please follow the instructions and ASAP. It is a project work. we need to write a...
please follow the instructions and ASAP. It is a project work. we need to write a report about to ::: find a real-life corrosion problem that has not been solved, conduct a thorough investigation as to the cause(s) and type(s) of corrosion, and, finally, propose possible solutions for the problem, indicating which of the solutions is best and why. Submit a report that addresses these issues.
Can you guys answer this question for me please, need it asap!!! Please explain the difference...
Can you guys answer this question for me please, need it asap!!! Please explain the difference between systematic and unsystematic risk. In doing so, provide 4 examples of each type of risk. ( around ~200 words)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT