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 main class in the patient application to include a display method that has a parameter to pass a patient object and display its content.

Solutions

Expert Solution

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp_Patient
{
        class Patient{
        
                private int patientid;
                private string lastname;
                private string firstname;
                private int age;
                private string email;
                public int PatientID {
                        get { return patientid; }
                        set { patientid = value; }
                }
                public string LastName {
                        get { return lastname; }
                        set { lastname = value.ToUpper(); }
                }
                public string FirstName {
                        get { return firstname; }
                        set { firstname = value; }
                }
                public int Age {
                        get { return age; }
                        set { age = value; }
                }
                public string Email {
                        get { return email; }
                        set { email = value; }
                }
    public static void display(Patient patient){
        Console.WriteLine("FirstName : "+patient.FirstName);
        Console.WriteLine("LastName  : "+patient.LastName);
        Console.WriteLine("Age       : "+patient.Age);
        Console.WriteLine("Email     : "+patient.Email);

    }
    static void Main(string[] args) {
        Patient p = new Patient();
        p.FirstName = "Mark";
        p.LastName = "Clarkin";
        p.Age = 42;
        p.Email = "trysampleMail";
        display(p);
    }
        }

}

Code & Output Screenshots :


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 System; using System.Data.SqlTypes; using System.Globalization; using System.Reflection.Metadata.Ecma335; using System.Runtime.Intrinsics.X86; using System.Security.Cryptography.X509Certificates; namespace ConsoleApp4 { class...
using System; using System.Data.SqlTypes; using System.Globalization; using System.Reflection.Metadata.Ecma335; using System.Runtime.Intrinsics.X86; using System.Security.Cryptography.X509Certificates; namespace ConsoleApp4 { class Program { static void Main(string[] args) { AO function = new AO(1000, 3); function.Find(); } } class AO { public a(long _max , long _least) { max = _max; least = _least; numm = new long[1000]; } public long max; public long least; public long[] numm; public long Find() { long per =0; long sum = 0; for(int i=1; i<=max; i++) {    for(int...
Array based application #include <iostream> #include <string> #include <fstream> using namespace std; // Function prototypes void...
Array based application #include <iostream> #include <string> #include <fstream> using namespace std; // Function prototypes void selectionSort(string [], int); void displayArray(string [], int); void readNames(string[], int); int main() {    const int NUM_NAMES = 20;    string names[NUM_NAMES];    // Read the names from the file.    readNames(names, NUM_NAMES);    // Display the unsorted array.    cout << "Here are the unsorted names:\n";    cout << "--------------------------\n";    displayArray(names, NUM_NAMES);    // Sort the array.    selectionSort(names, NUM_NAMES);    //...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT