Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 16 of 16

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

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.
    Attached Files Attached Files


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    6,098
    My Mood
    Mellow
    Thanks
    244
    Thanked 754 Times in 740 Posts

    Default 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.

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

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

    Post the code you are having here on the forum, not a link.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

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

    That is not unusual.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

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

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

    Default 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.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

    Default 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?
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

    Default 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?
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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?

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

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

    get help with each step if possible?
    Post a step and ask some questions about the problems you are having with it.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,916
    Thanks
    55
    Thanked 2,352 Times in 2,323 Posts

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

    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.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Poker Hand Program... Is this right?
    By kbrady481 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 2nd, 2013, 06:55 PM
  2. Replies: 1
    Last Post: December 13th, 2012, 08:47 PM
  3. I need a hand in editing this game
    By FEU_4thyear in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 6th, 2012, 08:14 AM
  4. [SOLVED] helping hand required
    By arvindbis in forum Web Frameworks
    Replies: 4
    Last Post: October 7th, 2011, 01:29 PM
  5. BUmp* **Anyone knows the proces of hand detection algorithm?
    By Cross`17 in forum Algorithms & Recursion
    Replies: 1
    Last Post: May 21st, 2010, 06:11 PM