Questions
Question: You are hired to develop an automatic patient monitoring system for a home-bound patient. The...

Question: You are hired to develop an automatic patient monitoring system for a home-bound patient. The system is required to read out the patient’s heart rate and blood pressure and compare them against specified safe ranges. The system also has activity sensors to detect when the patient is exercising and adjust the safe ranges. In case an abnormality is detected, the system must alert a remote hospital. (Note that the measurements cannot be taken continuously, since heart rate is measured over a period of time, say 1 minute, and it takes time to inflate the blood-pressure cuff.) The system must also

(i) check that the analog devices for measuring the patient’s vital signs are working correctly and report failures to the hospital

(ii) alert the owner when the battery power is running low.

Enumerate and describe the requirements for the system-to-be.

In: Computer Science

*Please give the answers in pseudo code 1) Design an algorithm that will receive two integer...

*Please give the answers in pseudo code

1) Design an algorithm that will receive two integer items from a terminal operator, and display to the screen their sum, difference, product and quotient. Note that the quotient calculation (first integer divided by second integer) is only to be performed if the second integer does not equal zero.


2) Design an algorithm that will read two numbers and an integer code from the screen. The value of the integer code should be 1, 2, 3 or 4. If the value of the code is 1, compute the sum of the two numbers. If the code is 2, compute the difference (first minus second). If the code is 3, compute the product of the two numbers. If the code is 4, and the second number is not zero, compute the quotient (first divided by second). If the code is not equal to 1, 2, 3 or 4, display an error message. The program is then to display the two numbers, the integer code and the computed result to the screen.


3) Design an algorithm that will receive the weight of a parcel and determine the delivery charge for that parcel. Charges are calculated as follows:
Parcel weight (kg)
Cost per kg ($)
<2.5
$3.50 per kg
2.5-5 kg
$2.85 per kg
>5 kg
$2.45 per kg

In: Computer Science

1.Write an HTML footer element to that states: o“Copyright 2019. All rights reserved”, using the copyright...

1.Write an HTML footer element to that states:

o“Copyright 2019. All rights reserved”, using the copyright symbol

oThe company e-mail, [email protected] as an e-mail link

In: Computer Science

This code assigns the maximum of the values 3 and 5 to the int variable max...

This code assigns the maximum of the values 3 and 5 to the int variable max and outputs the result

int max;

// your code goes here

This code prompts the user for a single character and prints "true" if the character is a letter and "false" if it is not a letter

// your code goes here

In: Computer Science

Consider the following pseudo-code: /* Global memory area accessible by threads */ #define N 100 struct...

Consider the following pseudo-code:

/* Global memory area accessible by threads */
#define N 100
struct frame *emptyStack[N];
struct frame *displayQueue[N];
int main() {
  /*
  ** Initialise by allocating the memory for N frames
  ** And place the N frame addresses into the
  ** empty Stack array
  */
  Initialise();
  thread_t tid1, tid2;
  threadCreate(&tid1, GetFrame);
  threadCreate(&tid2, ShowFrame);
  sleep(300);
}
GetFrame() {
  struct frame *frame;
  struct frame local;
  while (1) {
    CameraGrab(&local);  /* get a frame from the camera store it in local */
    frame = Pop(); /* pop an empty-frame address from the empty stack */
    CopyFrame(&local, frame); /* copy data from the local frame to the frame address */
    Enqueue(frame); /* push the frame address to the display queue */
}
}
ShowFrame() {
  struct frame *frame;
  struct frame local;
  struct frame filtered;
  while (1) {
    frame=Dequeue(); /* pop the leading full frame from the full queue */
    CopyFrame(frame, &local); /* copy data to the local frame */
    Push(frame);          /* push the frame address to the empty stack */
    Solarise(&filtered, &local); /* Modify the image */
    VideoDisplay(&filtered);     /* display the image */
  }

}

This program creates two threads, one calls GetFrame(), which continually grabs frames from a camera, and the other thread callsShowFrame(), which continually displays the frames (after modification). When the program starts the emptyStack contains the addresses of N empty frames in memory.

The process runs for 5 minutes displaying the contents from the camera.

The procedures Pop() and Push() are maintaining the list of frame addresses on the empty stack. Pop() removes a frame memory address from the empty stack, and Push() adds a memory address to the empty stack.

The procedures Dequeue() and Enqueue() are maintaining the list of frame memory addresses in the display queue in display order. Dequeue() removes the memory address of the next frame to display from the display queue, and Enqueue() adds a memory address to the end of the display queue.

The stack and the queue are the same size, and are large enough to contain all available frame memory addresses.

  1. Without including synchronisation code problems will occur. Discuss what could potentially go wrong?

  2. Identify the critical sections in the above pseudo-code.

  3. Modify the above pseudo-code using semaphores only, to ensure that problems will not occur.

    Hint: this is a variation on the Producer-Consumer problem and will require similar semaphores.

In: Computer Science

Java Programing: Predefined mathematical methods that are part of the class Math in the package java.lang...

Java Programing:

Predefined mathematical methods that are part of the class Math in the package java.lang include those below.

method name

description

abs( m )

returns the absolute value of m

ceil( m )

rounds m to the smallest integer not less than m

floor( m )

rounds m to the largest integer not greater than m

max( m , n )

returns the larger of m and n

min( m , n )

returns the smaller of m and n

pow( m , n )

returns m raised to the power n

round( m )

returns a value which is the integer closest to m

sqrt( m )

returns a value which is the square root of m

Evaluate each of the following, which include Math predefined methods.

(1)       _____ Math.abs( 6.0 )              (2)       _____ Math.abs( - 6.0 )

(3)       _____ Math.ceil( 10.25 )           (4)       _____ Math.ceil( - 6.8 )

(5)       _____ Math.floor( - 5.1 )           (6)       _____ Math.floor( 7.9 )

(7)       _____ Math.pow( 5 , 2 )             (8)       _____ Math.pow( 2 , 5 )

(9)       _____ Math.max( 1.5 , 2 )           (10)     _____ Math. min( 3 , 0.5 )

(11)     _____ Math.min( 2 , 1.5 )           (12)     _____ Math. max( 0.5 , 3 )

(13)     _____ Math.sqrt( 16.0 )            (14)     _____ Math. round( 0.6 )

(15)     _____ Math.ceil( Math.pow( 3 , 0.5 ) )

(16)     _____ Math.floor( Math.pow( 1.5 , 2 ) )   

(17)     _____ Math.ceil( Math.floor( 3.5 ) )

(18)     _____ Math.min( Math.max( 3.0 , 2 ), 2.5)

(19)     _____ Math.max( Math.min( 2.0 , 3 ), 3.0)

(20)     _____ Math.sqrt( Math.pow( 2.0 , 3 ) )    

(21)     _____ Math.pow( Math.sqrt( 9 ) , 2 ) )

(22)     _____ Math.round( Math.max( 2.1 , 3.1 ) )

(23)     _____ Math.abs( Math.abs( 8.0 ) )

(24)     _____ Math.min( Math.abs( 1.5 , 2 ) )

(25)     _____ Math.ceil( Math.pow( 1 , 0.5 ) )

In: Computer Science

Task Intro: Password JAVA and JUnit5(UNIT TESTING) Write a method that checks a password. The rules...

Task Intro: Password JAVA and JUnit5(UNIT TESTING)

Write a method that checks a password. The rules for the password are:

- The password must be at least 10 characters.
- The password can only be numbers and letters.
- Password must have at least 3 numbers.
Write a test class(Junit5/Unit testing) that tests the checkPassword method.

Hint: You can (really should) use method from built-in String class:

public boolean matches(String regex)
to check that the current string matches a regular expression. For example, if the variable "password" is the string to be checked, so will the expression.
password.matches("(?:\\D*\\d){3,}.*") 

return true if the string contains at least 3 numbers. Regular expression "^ [a-zA-Z0-9] * $" can be used to check that the password contains only numbers and letters.

Let your solution consist of 4 methods:

checkPassword(string password) [only test this method]
checkPasswordLength(string password) [checkPassword help method]
checkPasswordForAlphanumerics(string password) [checkPassword help method]
checkPasswordForDigitCount(string password) [checkPassword help method]

Intro: Password Criteria

The code is structured and formatted
Your code uses the standard java formatting and naming standard, it is also nicely formatted with the right indentation etc.
Good and descriptive variable names
Your code uses good variable names that describe the damped function, such as "counter" instead of "abc".

The code is logical and understandable

Your code is structured in a logical way so it's easy to understand what you've done and how to solve the problem. It should be easy for others to understand what your code does and how it works.

The solution shows understanding of the problem
You show with your code that you have thought about and understood the problem. It is worth thinking about how you will solve the problem before you actually solve it
The code solves the problem
Your code manages to do what is required in the assignment text, and it does not do unnecessary things either.
Unit tests (Junit5) cover all common use cases
Unit tests for your code check all common ways it can be used, such as the isEven (int number) method being tested with even, odd, negative, and null, reverseString (String text) will be checked with regular string, empty string and zero object, etc.
The code uses Regex and built-in methods
Do not try to reinvent the wheel, it is possible to check the text string for digits with a while / for loop, but using regex and matching function is much easier. There are many websites that help you find regex for what you need, so use them.

So my problem is that I need to unit test (JUnit5) my code below (Feel free to change the code, to fit the assigment better)

import java.util.Scanner;
import java.util.regex.Pattern;

public class Password {
   public static void main(String[] args) {
       Password call = new Password();
      
   }
  
   void checkPassword() {
       Scanner x = new Scanner(System.in);
       System.out.println("Enter your password");
       String y = x.nextLine();
      
      
       Password n = new Password();
       boolean v1 = n.checkPasswordForAlpanumerics(y);
       boolean v2 = n.checkPasswordForDigitCount (y);
       boolean v3 = n.checkPasswordLength(y);
       if(v1== true && v2 == true && v3 ==true) {
           System.out.println("Your password is valdid");}
          
       }
      
       boolean checkPasswordLength (String x) {
           int checklen=x.length();
           if(checklen>=10) {
               return true;}
           else {
               System.out.println("enter atleast 10 charachers");
               return false; }}
      
       boolean checkPasswordForAlpanumerics (String x) {
           String b = "^ [a-zA-Z0-9] * $";
           boolean check=Pattern.matches(b, x);
           if(check==true) {
               return true;}
          
           else {
               System.out.println("Password must contain numbers and letters only");
               return false; }}
      
       boolean checkPasswordForDigitCount (String s) {
           int count = 0;
           for ( int i = 0;i<s.length();i++) {
               if (Character.isDigit(s.charAt(i))) {
                   count++;}}
           if(count>=3) {
               return true; }
           else {
               System.out.println("Your password must contain atleast 3 numbers");
               return false;}
          
                  
               }}
      
              
          

In: Computer Science

I need a masters research thesis topic on data science or data analysis. you may wish...

I need a masters research thesis topic on data science or data analysis. you may wish to add an outline. thanks

In: Computer Science

8.    Within the footer, place a link to auto-call the company line: 800-685-2298. Display the text:...

8.    Within the footer, place a link to auto-call the company line: 800-685-2298.
Display the text: “Call Today” as a text link.

In: Computer Science

class LLNode<T> { public T info; public LLNode<T> link; public LLNode(T i, LLNode<T> l) { //...

class LLNode<T> {

public T info;

public LLNode<T> link;

public LLNode(T i, LLNode<T> l) { // constructor

info=i;

link=l;

}

}

class CircularLinkedQueue<T> {

private LLNode<T> rear = null; // rear pointer

public boolean isEmpty() {

/*checks if the queue is empty */

}

public int size() {

/* returns the number of elements in the queue */

}

public void enQueue(T element) {

/* enqueue a new element */

}

public T deQueue() {

/* dequeue the front element */

}

public String toString() {

String str = new String();

/* concatenate elements to a String */

return str;

}

}

In: Computer Science

* Word file clearly describe the test suite (series of test cases) you design for each...

* Word file clearly describe the test suite (series of test cases) you design for each of the methods in TestWithJUnit.java (one test suite per method). Each test suite should contain at least 5 test cases. Each test case has to be justified: Why did you pick this test case and not another one? Imagine you are limited by time and money about the number of test cases you can pick and run. Why would you make run the test cases you propose? You have to be convincing. In particular, you have to address: WHAT each test case aims to test, and HOW you expect the method to run on this test case (what output do you expect?).

*In a new java file, that you will call TestWithJUnitTester.java, write a JUnit test for each of the test cases you have described in your word file.

* Run your test cases and report the results in your word document. In particular, you have to report whether the method behaves as expected or not on each test case, and propose an explanation in case the method does not behave as expected.

Note: your test cases cannot include the examples given within the code.

Advice: when designing test cases, think:

1/ regular functionality test: does the code perform as expected under normal/expected circumstances?

2/ edge case: does the code still perform when under stress of its expected conditions?

You need to have at least one of the first type (maybe two depending on how complex the code is), and 3 or 4 of the second type.

public class TestWithJUnit {

   /* Method withoutTen:
   * Return a version of the given array where all
   * the 10's have been removed.
   * The remaining elements should shift left
   * towards the start of the array as needed,
   * and the empty spaces a the end of the array
   * should be 0.
   * So {1, 10, 10, 2} yields {1, 2, 0, 0}.
   * {1, 10, 10, 2, 10, 3, 10} yields {1, 2, 3, 0, 0, 0, 0}.
   */
   public int[] withoutTen(int[] A) {
       int[] result = new int[A.length];
       int index = 0;
      
       for (int i = 0; i < A.length; i++) {
           if (A[i] != 10) {
               result[index] = A[i];
               index++;
           }
       }
       for (int i = index; i < result.length; i++)
           result[i] = 0;
      
       return result;
   }
  
   /* Method bigArray:
   * Given an integer n, bigArray creates and returns a 1D array
   * that contains {1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, ... n}
   * For instance, bigArray(4) = {1, 1, 2, 1, 2, 3, 1, 2, 3, 4}
   * bigArray(2) = {1, 1, 2}
   */
   public int[] bigArray(int n) {
       int[] result = new int[n*(n+1)/2];
       int index = 0;
      
       for (int i = 1; i <= n; i++) {
           for (int j = 1; j <= i; j++) {
               result[index] = j;
               index++;
           }
       }
      
       return result;
   }
      
}

In: Computer Science

there are only three roles in a scrum team. In your opinion, what might be some...

there are only three roles in a scrum team. In your opinion, what might be some team responsibilities that are not covered in any of these roles? Could you see yourself becoming a scrum master? Why or why not

In: Computer Science

Question 1 (25 marks) A local online trading company, Bursa Malaysia (BSKL) is running out of...

Question 1

A local online trading company, Bursa Malaysia (BSKL) is running out of capacity and performance with the current storage system. BSKL has decided to own a RAID system at a reasonable cost to increase the speed, capacity, availability and scalability of the trading activities.

(a) Identify any FIVE (5) RAID systems that might be suitable for BSKL. (Refer to the BSKL website to understand the online activities that have been actively running.)

[10 marks]

In: Computer Science

(Python Programming) You are asked to develop a cash register for a fruit shop that sells...

(Python Programming)

You are asked to develop a cash register for a fruit shop that sells oranges and apples. The program will first ask the number of customers. Subsequently, for each customer, it will ask the name of the customer and the number of oranges and apples they would like to buy. And then print a summary of what they bought along with the bill as illustrated in the session below:

How many customers?  2    
Name of Customer 1  Harry  
Oranges are $1.40 each. 
How many Oranges?  1  
Apples are $.75 each. 
How many Apples?  2  
Harry, you bought 1 Orange(s) and 2 Apple(s).  
Your bill is $2.9    
Name of Customer 2  
Sandy  
Oranges are $1.40 each. 
How many Oranges?  10  
Apples are $.75 each. 
How many Apples?  4  
Sandy, you bought 10 Orange(s) and 4 Apple(s).  
Your bill is $17.0

In: Computer Science

Exercise 1: Write an XML document describing the exercises in this document: the root element is...

Exercise 1:

Write an XML document describing the exercises in this document: the root element is <exercises>. The root has an attribute number that has value 1. The root element has three child elements; <date> that contains as text the date of the exercise, and two <item> elements for the first two exercises (1--2). Write some text in the <item> elements.

Exercise 2:

Write an XML document describing a person: name, occupation, address and hobbies. Please do not use your own information, you can use fake data. Decide on suitable element names and nesting. Check your document for well-formedness.

Exercise 3:

Draw a tree that represents the XML document you created in task 2.

Exercise 4:

This is the books.xml file

<?xml version='1.0'?>
<!-- This file represents a fragment of a book store inventory database -->
<bookstore>

<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">

<title>The Autobiography of Benjamin Franklin</title>
<author>

<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>

</author>

<price>8.99</price>

</book>

<book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">

<title>The Confidence Man</title>

<author>

<first-name>Herman</first-name>
<last-name>Melville</last-name>

</author>

<price>11.99</price>

</book>

<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">

<title>The Gorgias</title>
<author>

<name>Plato</name>

</author>

<price>9.99</price>

</book>

</bookstore>

Using books.xml as a model, create a small xml file for a student's program of study form called programOfStudy.xml. It should capture the following data:

  • In the Fall 2008 semester the student plans to take two classes to satisfy her General Education requirements, PHIL 101 to satisfy Goal 8 and ECON 201 to satisfy Goal 11. She also has to take one core course, MGT 217, and two major courses, CIS 120 and CIS 403.
  • In the Spring 2009 semester she plans to take two additional core courses, MGT 261 and MKTG 325, as well as three major courses, CIS 220, CIS 407, and CIS 490.

In: Computer Science