1 Attachment(s)

Any chance someone could give me a help in hand?

I am currently doing some work on a NHS programs and I am stuck on a few things, I will upload a PDF, but I am stuck on tasks 2.5 and 2.7.

If anyone could help me code this out, it would be greatly appreciated. I am able to upload already written code if need be.

Re: Any chance someone could give me a help in hand?

It's a "helping hand."

Yes, we need to see your effort and understand exactly what you need help with. Describe how the output/results are not as expected or noncompliant with sample runs if possible, post errors exactly as they appear at your end, copied and pasted, ask specific questions.

Re: Any chance someone could give me a help in hand?

Am I able to upload a folder with different source code in it? I'm just not 100% about what I'm doing since I'm new to Java, so not sure how to call methods for them to run etc.

Re: Any chance someone could give me a help in hand?

Post the code you are having here on the forum, not a link.

Re: Any chance someone could give me a help in hand?

I have different sections of code though, it isn't all in one class

Re: Any chance someone could give me a help in hand?

Re: Any chance someone could give me a help in hand?

How do you propose I upload them for you to see?

Re: Any chance someone could give me a help in hand?

Use copy and paste.

Be sure to wrap the code in code tags:

[code=java]

YOUR CODE HERE

[/code]

to get highlighting and preserve formatting.

Re: Any chance someone could give me a help in hand?

Code java:

import java.util.ArrayList;
import java.util.Iterator;
public class EWS_Engine {
///Task 2.1
public int EWS(int hr, float bp, float temp, int rr, int spo2){
//RR
int ews=0;
if ( rr <= 8)
{
ews = +3;
}
else if ( rr <=11)
{
ews = +1;
}
else if ( rr <=24)
{
ews = +2;
}
else if ( rr >= 25)
{
ews = +3;
}
//SPO2
if ( spo2 <=91)
{
ews = +3;
}
else if (spo2 <=93){
ews = +2;
}
else if (spo2 <=95){
ews = +1;
}
//HR
if ( hr <=40)
{
ews = +3;
}
else if (hr <=50){
ews = +1;
}
if (hr >=131){
ews = +3;
}
else if (hr >=111){
ews = +2;
}
else if (hr >=91){
ews = +1;
}
//BP
if ( bp <=90)
{
ews = +3;
}
else if (bp <=100){
ews = +2;
}
else if (bp <=110){
ews = +1;
}
else if (bp <=220){
ews = +3;
}
//Temp
if ( temp <=35)
{
ews = +3;
}
else if (temp <=36){
ews = +1;
}
if (temp >=38.1){
ews = +1;
}
else if (temp >=39.1){
ews= +2;
}
return ews;
}
//Task 2.2
public int EWS(VitalSign data){
//input correct variables into other ews method
return EWS(data.getHr(),data.getBp(),data.getTemp(), data.getRr(), data.getSpo2());
}
}
return EWS(data.getHr(), data.getBp(), data.getTemp(), data.getRr(), data.getSpo2());
}
//Task 2.3
public ArrayList<String> fuzzyEWS(ArrayList<VitalSign> data) {
ArrayList<String> traffic = new ArrayList<String>();
for(int i =0;i < data.size();i++) {
if (EWS(data.get(i)) <= 1) {
traffic.add("Green");
}
else if (EWS(data.get(i)) <5) {
traffic.add("Amber");
}
else if (EWS(data.get(i)) >= 5) {
traffic.add("Red");
}
}
return traffic;
}
public boolean testFuzzyEWS(ArrayList<VitalSign> data,ArrayList<String> correct_answers) {
boolean test = true;
fuzzyEWS(data);
for (int i =0; i<data.size();i++){
if (!data.get(i).equals(correct_answers.get(i))) { test = false;}
}
return test;
}
}
//Task 2.4
public void assignTimestamp(int interval, ArrayList<VitalSign> data) {
for (int i =0;i<data.size();i++){
data.get(i).setTimestamp(i * interval);
}
}
public void printEWSMessage(String path, int interval, long start, long end) {
ArrayList<VitalSign> samples = DataImporter.importFromDataFile(path);
ArrayList<VitalSign> sampleinterval = new ArrayList<VitalSign>();
assignTimestamp(interval, samples);
//Changes start and end to the index of the array it corresponds to
start = start + (start%interval);
start = start / interval;
end = end - (end % interval);
end = end /interval;
if (start>end){
long whatstartwas = start;
start = end;
end = whatstartwas;
}
// If end is larger than array size
if (end>samples.size()){
end = samples.size();
}
else if (end <0) {
end = 0;
}
if (start < 0){
start = 0;
}
else if (start > samples.size()){
start = samples.size();
}
for (int i=(int)start;i<end;i++){
sampleinterval.add(samples.get(i));
}
ArrayList<String> traffic = fuzzyEWS(sampleinterval);
for (int i=(int)start;i<end;i++){
System.out.println(traffic.get(i));
}
}
}

This is my main program so far.

Re: Any chance someone could give me a help in hand?

Do you have any specific questions about the code or problems with the assignment?

Re: Any chance someone could give me a help in hand?

I just need help with the tasks I have stated. I am new to Java and I am really struggling where to even begin so I was wondering if there is any chance you could maybe guide me through it if possible.

Re: Any chance someone could give me a help in hand?

Do you have any specific questions about the assignment? Please ask them.

For example:

How do I read input from the user and save it in a variable?

Re: Any chance someone could give me a help in hand?

That's my problem, I don't have any specific questions. I just need help i.e. a dry run. I have no idea where to start, I was just wondering if there is any chance I could get help with each step if possible?

Re: Any chance someone could give me a help in hand?

Quote:

get help with each step if possible?

Post a step and ask some questions about the problems you are having with it.

Re: Any chance someone could give me a help in hand?

So for example I need to import simulated vital sign data from the path, and initializes timestamps according to the interval. I don't know if you need my other code in order to understand this.

Re: Any chance someone could give me a help in hand?

Quote:

need to import simulated vital sign data from the path, and initializes timestamps according to the interval

There are a lot of terms in that quote that need definitions. I don't know what you mean:

import

simulated sign data

path

timestamps

interval

That statement has no meaning with respect to how to design code to implement it.