Question

In: Computer Science

Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace...

Patient.cs :

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace ConsoleApp_Patient
{
class Patient //C# class
{
//private fields for patientid, lastname,firstname, age, and email.
private int patientid;
private string lastname;
private string firstname;
private int age;
private string email;
//public data items for each of these private fields with get and
//set methods
public int PatientID //Public field for patientid
{
get { return patientid; }
set
{
patientid = value;//set patinetid
}
}
public string LastName //Public field for lastname
{
get { return lastname; }
set
{
lastname = value.ToUpper();//set lastname in upper case
}
}
public string FirstName //Public field for firstname
{
get { return firstname; }
set
{
firstname = value;//set firstname
}
}
public int Age //Public field for age
{
get { return age; }
set
{
age = value;//set age
}
}
public string Email //Public field for email
{
get { return email; }
set
{
email = value;//set email
}
}
}
}

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

Modify the patient class with two overloaded methods to display a bill for astandard 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

Solutions

Expert Solution

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace ConsoleApp_Patient
{
    class Patient //C# class
    {
        //private fields for patientid, lastname,firstname, age, and email.
        private int patientid;
        private string lastname;
        private string firstname;
        private int age;
        private string email;
        //public data items for each of these private fields with get and
        //set methods
        public int PatientID //Public field for patientid
        {
            get { return patientid; }
            set
            {
                patientid = value;//set patinetid
            }
        }
      
        public string LastName //Public field for lastname
        {
            get { return lastname; }
            set
            {
                lastname = value.ToUpper();//set lastname in upper case
            }
        }
      
        public string FirstName //Public field for firstname
        {
            get { return firstname; }
            set
            {
                firstname = value;//set firstname
            }
        }
      
        public int Age //Public field for age
        {
            get { return age; }
            set
            {
                age = value;//set age
            }
        }
      
        public string Email //Public field for email
        {
            get { return email; }
            set
            {
                email = value;//set email
            }
        }
      
      
        // overloaded methods
        // takes no argument
        public void DisplayBill() {
          
            if(Age >=65 ) {
                Console.WriteLine(" Bill Amount for a standard visit is 75$ ");
            }
            else {
                Console.WriteLine(" Bill Amount for a standard visit is 125$ ");
            }
        }
      
        // takes discount as an argument
        public void DisplayBill(float discount ) {
          
             if(Age >=65 ) {
               
                 float bill = 75 - (discount/100)*75;
                Console.WriteLine(" Bill Amount for a standard visit is: "+bill);
            }
            else {
              
                 float bill = 125 - (discount/100)*125;
                Console.WriteLine(" Bill Amount for a standard visit is: "+ bill);
            }
        }

      
  
      
    }
}

THANK YOU!! If you have any doubt, please ask in comment section, I will answer ASAP. If you like my effort please UPVOTE.


Related Solutions

Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace...
Patient.cs : //namespace using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //application namespace namespace ConsoleApp_Patient { class Patient //C# class { //private fields for patientid, lastname,firstname, age, and email. private int patientid; private string lastname; private string firstname; private int age; private string email; //public data items for each of these private fields with get and //set methods public int PatientID //Public field for patientid { get { return patientid; } set { patientid = value;//set patinetid }...
Given code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary1 { public...
Given code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary1 { public class Car { // fields private decimal _CurrentSpeedMPH; // the cars current speed private decimal _MaxSpeedMPH; // the upper limit, the car cannot exceed this value private bool _EngineRunning; // true means the engine has been started and is running, false says engine is off public Car(decimal maxSpeed) // constuctor, user chooses to set maxSpeed as they create the object { _MaxSpeedMPH = maxSpeed;...
Given the partially coded project: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace...
Given the partially coded project: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StaticHW {    class Program { static void Main(string[] args) { // will have 3 Dogs Dog[] allDogs = new Dog[3]; allDogs[0] = new Dog(20f, 10f, "Fido"); allDogs[1] = new Dog(40f, 20f, "Percy"); allDogs[2] = new Dog(70f, 30f, "Snoopy"); // comment out the next 3 lines until you have written the Dog class and the code runs ok // then put these 3 lines...
Given Codes: Program.cs & Car.cs Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;...
Given Codes: Program.cs & Car.cs Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ClassLibrary1; namespace ConsoleCarsExcpeptions { class Program { static void Main(string[] args) { Car myCar = new Car(35); // call constructor and set speed max to 35 (tiny engine!!) string ErrorMessage = "All is well"; bool done = false; // loop control variable while (!done) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("start = start engine, stop = stop engine"); Console.Write("accel = accelerate, brake = brake,...
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Assignment07 { class Dog { public void...
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Assignment07 { class Dog { public void bark(string dogsName) { int barking =5; while(barking < 5)    Console.WriteLine(dogsName + " is barking"); } public void run(string dogsName) { int running = 10; while(running > 10) Console.WriteLine(dogsName + " is running"); } } class Program { static void Main(string[] args) { Dog fido = new Dog(); fido.bark("Fido"); fido.run("Fido"); Console.Write("Hit any key to close"); Console.ReadKey(true); } } } need to create 2 while...
// Assignment06.cpp : Defines the entry point for the console application. // #include #include using namespace...
// Assignment06.cpp : Defines the entry point for the console application. // #include #include using namespace std; int main() { string s = "this is a test, this is also a test, this is yet another test"; int strLen = 0; strLen = s.length(); // code will go here cout << s << endl; return 0; } Add code to capitalize all of the lowercase ‘t’s. The problem may be simple, but the solution may be a bit tricky.
using only loops, no functions and no arrays. with the heading: #include <iostream> using namespace std;...
using only loops, no functions and no arrays. with the heading: #include <iostream> using namespace std; "Write a program that asks the user to enter an odd positive integer. The program reads a value (n) entered by the user and prints an n x n grid displaying a large letter X. The left half should be made up of pluses (+) and the right half should be made with the character "x" and the very center should be an asteric...
Using only loops, no functions and no arrays. with the heading: #include <iostream> using namespace std;...
Using only loops, no functions and no arrays. with the heading: #include <iostream> using namespace std; "Write a program that asks the user to enter an integer between 1 and 20. If the user enters an illegal number, the program repeatedly asks the user to enter the correct one. If the user has not entered a correct number after 10 attempts, the program chooses the number 10 as the user's number. The program prints the cube of the user's number.
write down discussion/result and application of the patient condition system by using PIC box when the...
write down discussion/result and application of the patient condition system by using PIC box when the question is displayed on the LCD the question is ''how you feel today?'' after that, we have three options 1 is very well 2 well 3 sick.
application that uses linux operating system amd justify the linux operating system. provide a suitable application...
application that uses linux operating system amd justify the linux operating system. provide a suitable application that uses linux os and justify the usage of linux os in the considered application.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT