Cerner Corporation Interview Question for Software Engineers


Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

public class PatientHealthInfo {
public static void main(String[] args) {
Patient pt = new Patient();
pt.setName("jack");
Allergy al = new Allergy();
al.setAllergyName("rashes");
al.setSeverity("medium");
Allergy al1 = new Allergy();
al1.setAllergyName("sweling");
al1.setSeverity("medium");
List<Allergy> allergyList = new ArrayList<Allergy>();
allergyList.add(al);
allergyList.add(al1);
pt.setAllergyList(allergyList);
String str = patient(pt);

System.out.println(" Result is :: " + str);
}

public static String patient(Patient pt){
if(pt.getAllergyList().size() > 0){
return "allergy";
}
else if (pt.getDiseaseList().size() > 0){
return "diease";
}
return null;
}

}
====================
public class Patient {

private String name;

private int age;

private List<Allergy> allergyList;

private List<Disease> diseaseList;


public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public List<Allergy> getAllergyList() {
return allergyList;
}

public void setAllergyList(List<Allergy> allergyList) {
this.allergyList = allergyList;
}

public List<Disease> getDiseaseList() {
return diseaseList;
}

public void setDiseaseList(List<Disease> diseaseList) {
this.diseaseList = diseaseList;
}
}
=================================================
public class Allergy {

private String allergyName;

private String severity;

public String getAllergyName() {
return allergyName;
}

public void setAllergyName(String allergyName) {
this.allergyName = allergyName;
}

public String getSeverity() {
return severity;
}

public void setSeverity(String severity) {
this.severity = severity;
}
}
====================================
public class Disease {

private String diseaseName;

}

- Apurva August 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class Patient {

private String name;

private int age;

private List<Allergy> allergyList;

private List<Disease> diseaseList;


public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public List<Allergy> getAllergyList() {
return allergyList;
}

public void setAllergyList(List<Allergy> allergyList) {
this.allergyList = allergyList;
}

public List<Disease> getDiseaseList() {
return diseaseList;
}

public void setDiseaseList(List<Disease> diseaseList) {
this.diseaseList = diseaseList;
}
}
------------------------------------------------------------------------------------------------------
public class Allergy {

private String allergyName;

private String severity;

public String getAllergyName() {
return allergyName;
}

public void setAllergyName(String allergyName) {
this.allergyName = allergyName;
}

public String getSeverity() {
return severity;
}

public void setSeverity(String severity) {
this.severity = severity;
}
}
---------------------------------------------------------------------------------------------------------------------
public class Disease {
private String diseaseName;
}
---------------------------------------------------------------------------------------------------------------------
public class PatientHealthInfo {

public static void main(String[] args) {
Patient pt = new Patient();
pt.setName("jack");
Allergy al = new Allergy();
al.setAllergyName("rashes");
al.setSeverity("medium");
Allergy al1 = new Allergy();
al1.setAllergyName("swelling");
al1.setSeverity("medium");
List<Allergy> allergyList = new ArrayList<Allergy>();
allergyList.add(al);
allergyList.add(al1);
pt.setAllergyList(allergyList);
String str = patient(pt);

System.out.println(" Result is :: " + str);
}

public static String patient(Patient pt){
if(pt.getAllergyList().size() > 0){
return "allergy";
}
else if (pt.getDiseaseList().size() > 0){
return "diease";
}
return null;
}

}

- Apurva August 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Is it coded with good coding practice?

The one who wrote this code , What is the interviewer feedback?

- Anonymous September 10, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

it dosent work

- Anonymous May 19, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Maybe you can include some enums rather than String datatypes to aboud any typing errors. For example, an enum for severity can have constant values like LOW,HIGH,MODERATE . I had the same experience in an interview. The interviewer wanted me to be more creative with methods and asked to avoid using String datatype at all

- Anonymous May 14, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

and

- Anonymous April 29, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

yay!

- Shubh April 29, 2019 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More