.Centralized and decentralized service offer some challenges to the food service .what are these challenges and...

.Centralized and decentralized service offer some challenges to the food service .what are these challenges and how they are best addressed please explain ?

In: Operations Management

write the program named Lab06.java that contains the following four static methods: • public static double...

write the program named Lab06.java that contains the following four static methods:

• public static double max(double[] data) that returns the maximum value in the array data

• public static double min(double[] data) that returns the minimum value in the array data

• public static double sum(double[] data) that sums all items in the array and return the result

• public static double ave(double[] data) that call the sum() method and then return the average.

Once you have completed the methods above, write a simple main program that does the following:

1. Asks the user how many items will be entered

2. Creates an array of double of the correct size

3. Prompts the user and reads in the values

4. Calculates and prints out the max, min, sum, and average using the methods above.

In: Computer Science

Build a case for and against non-reciprocity principles in developing countries. Be sure to provide a...

Build a case for and against non-reciprocity principles in developing countries. Be sure to provide a comprehensive rationale for each position and examples.

In: Economics

Im working on modifying my current code to function with these changes below Create a Java...

Im working on modifying my current code to function with these changes below

Create a Java program that meets the following criteria

  • You program should contain a “static method” double[] readArray(String filename) which accepts the name of a file to read as a String parameter.
    • This function should read all the values into a new array of “doubles”
      • NOTE: The first value of the file is an integer used to indicate the size of the array that you will need (see above)
    • The function should return the array which was created and read in this method.
  • You program should contain a function double[] processArray() (double[] dataArray) which accepts the array read by the previous function.
    • This function should scan the array and calculate the following information:
      • The smallest value in the array.
      • The largest value in the array.
      • The average value in the array.
      • The sum of the values in the array.
      • A count of the number of items that are greater than the average value
      • The largest difference between any two adjacent values!
        1. For example, using the above sample input, the largest adjacent difference is between the values 7.876 and 3.1415 (array indexes 2 and 3), which is a difference of 4.7345.
        2. (This one is not terribly difficult, but it will require some thought!)
    • The function should return a new array of six values containing the information outlined above in the order shown.
      • For example, using the sample data file above, the array would contain the following values in the following order:
        { 1.23, 7.876, 3.9817, 19.9085, 2.0, 4.7345 }
      • The order is just: smallest, largest, average, sum, above average count, largest difference
  • The main method should:
    • Check to see the user passed a filename to main itself via the (String[] args)
      • If no file name exists, the program should prompt the user to enter a source-file name.
    • Call the functions above to read the array and calculate the results.
    • Display all the final results for example:

      Smallest = 1.23
      Largest = 7.876
      Average = 3.9817
      Sum = 19.9085
      Count of Larger than Average = 2.0
      Largest Difference = 4.7345

My current code is show as below, i was wondering how i would go about doing that im a little lost.

import java.io.File;
import java.util.Scanner;

public class Lab5 {

    public static void main(String[] args) {
        String inFileName;

        if (args.length > 1) {
            inFileName = args[0];
        } else {
            Scanner console = new Scanner(System.in);
            System.out.println("Enter a Filename: ");
            inFileName = console.nextLine();
        }

        double[] myData = readArray(inFileName);
        double[] results = processArray(myData);

        // TODO: Display Results...
    }

    static double[] readArray(String filename) {
        File inFile = new File(filename);

        if (inFile.canRead()) {
            try {
                Scanner fileScanner = new Scanner(inFile);
                int count = fileScanner.nextInt();
                double[] data = new double[count];

                for (int i = 0; i < count; i++) {
                    data[i] = fileScanner.nextDouble();
                }

                return data;
            } catch (Exception e) {
                return new double[0];
            }
        } else {
            System.out.println("Can't read file.");
            return new double[0];
        }
    }

    static double[] processArray(double[] dataArray) {
        // TODO: Implement Functionality from Requirements.
        for (double data : dataArray) {
            System.out.println(data);
        }

        return new double[0];
    }

}

In: Computer Science

Define and provide examples of the following terms (a) aromatic (b) hydrophilic (c) combustion (d) methylene...

Define and provide examples of the following terms

(a) aromatic (b) hydrophilic (c) combustion

(d) methylene group (e) methyl group (f) common name

(g) IUPAC name (h) conformations (i) Newman projection

(j) eclipsed (k) staggered   (l) gauche conformation

(m) anti conformation (n) catalytic cracking (o) cis-trans isomers of a ring

(p) chair conformation (q) boat conformation   (r) distorted boat

(s) half chair conformation (t) axial position (u) equatorial position

(v) chair-chair interconversion (w) fused ring system (x) bridged bicyclic compound

(y) bridgehead carbon atoms

In: Chemistry

1.1 For each of the following events, ceteris paribus, explain whether the production possibility frontier shifts...

1.1 For each of the following events, ceteris paribus, explain whether the production possibility frontier shifts inward, shifts outward or remains unchanged. Use a single diagram to motivate your answer.

1.1.1 The discovery of coal.

1.1.2 Training for workers that increases the amount of a good that can be produced per worker.

1.1.3 A shift in preference for one good compared to the other good.

1.1.4 Invention of a new process of production that reduces the resources necessary to produce a good.

1.2 “Market structure refers to the nature and degree of competition in the market for goods and services. There are a number of determinants of market structures for a particular good.” In terms of the statement above, discuss the following determinants for the four main types of market structures.

1.2.1 Nature of product

1.2.2 Entry and exit conditions

1.2.3 Economies of scale

In: Economics

Start with a program that allows the user to input a number of integers, and then...

Start with a program that allows the user to input a number of integers, and then stores them in an int array.

Write a function called maxint() that goes through the array, element by element, looking for the largest one.The function should take as arguments the address of the array and the number of elements in it, and return the index number of the largest element. The program should call this function and then display the largest element and its index number.

In: Computer Science

Update the following C code and write the function : void sln_stutter(sln_list* li); that modifies the...

Update the following C code and write the function :

void sln_stutter(sln_list* li);

that modifies the list li so that it each element is duplicated. For example the list with elements [1,2,3] would after this function call become the list [1,1,2,2,3,3].

#include <stdlib.h>
#include <stdio.h>
struct sln_node {
  struct sln_node* next;
  int key;
};
 
struct sln_list {
  struct sln_node* head;
};
typedef struct sln_node sln_node;
typedef struct sln_list sln_list;
static sln_node* freelist = NULL;
/* Internal bookkeeping functions for the free list of nodes. */
sln_node* sln_allocate_node() {
  sln_node* n;
  if(freelist == NULL) {
    freelist = malloc(sizeof(sln_node));
    freelist->next = NULL;
  }
  n = freelist;
  freelist = n->next;
  n->next = NULL;
  return n;
}
 
void sln_release_node(sln_node* n) {
  n->next = freelist;
  freelist = n; 
}
 
void sln_release_freelist() {
  sln_node* n;
  while(freelist != NULL) {
    n = freelist;
    freelist = freelist->next;
    free(n);
  }
}
/* Create a new singly-linked list. */
sln_list* sln_create() {
  sln_list* list = malloc(sizeof(sln_list));
  list->head = NULL;
  return list;
}
 
/* Release the list and all its nodes. */
 
void sln_release(sln_list* list) {
  sln_node* n = list->head;
  sln_node* m;
  while(n != NULL) {
    m = n->next;
    sln_release_node(n);
    n = m;
  }
  free(list);
}
 
/* Insert a new element to the list. */
 
void sln_insert(sln_list* list, int key) {
  sln_node* n = sln_allocate_node();
  n->key = key;
  n->next = list->head;
  list->head = n;
}
 
/* Check if the list contains the given element. Returns 1 or 0. */
 
int sln_contains(sln_list* list, int key) {
  sln_node* n = list->head; 
  while(n != NULL && n->key != key) {
    n = n->next;
  }
  return (n == NULL)? 0: 1;
}
 
/* Remove the first occurrence of the given element from the list. 
   Returns 1 if an element was removed, 0 otherwise. */
 
int sln_remove(sln_list* list, int key) {
  sln_node* n;
  sln_node* m;
  n = list->head;
  if(n == NULL) { return 0; }
  if(n->key == key) {
    list->head = n->next;
    sln_release_node(n);
    return 1;
  }
  while(n->next != NULL && n->next->key != key) {
    n = n->next;
  }
  if(n->next != NULL) {
    m = n->next;
    n->next = m->next;
    sln_release_node(m);
    return 1;
  }
  return 0;
}

In: Computer Science

I have a list of things for review in C programming, could you please give me...

I have a list of things for review in C programming, could you please give me an example and a brief explanation for each question... Thank you very much

  • 9. Apply pointer arithmetic to C code
  • 10. Explain how multiple files can be organized and run in C, as well as what (recommended) content can be placed in header files
  • 11. Explain how a link list can be created (i.e. what the nodes are and what components or syntax can be used to create the nodes)

In: Computer Science

Cyanide ion, CN-, is important in metal plating industries as well as in leaching matals from...

Cyanide ion, CN-, is important in metal plating industries as well as in leaching matals from ores because it keeps metals dissolved under conditions where they would otherwise form solids (precipitate) and settle out of solution. It is important to maintain pH>10.5 in these solutions to avoid forming toxic hydrogen cyanide gas. If a solution is prepared by dissolving 10-2M NaCN in water, will the pH be in the region where the solution is safe? What is {HCN} in the solution? The pKa of HCN is 9.24.

In: Chemistry

in free radical polymerization, wastage reaction are due to

in free radical polymerization, wastage reaction are due to

In: Chemistry

1) Describe the various shapes of synovial joints (e.g. hinge, condyloid, ball and socket, etc.) 2)...

1) Describe the various shapes of synovial joints (e.g. hinge, condyloid, ball and socket, etc.)

2) What types of movements can occur at synovial joints (e.g. gliding, angular, etc.)?

In: Anatomy and Physiology

Create a student attendance form in php. please provide source code examples

Create a student attendance form in php. please provide source code examples

In: Computer Science

Suppose we want to make a 10 item queue starting from location x4000. In class, we...

Suppose we want to make a 10 item queue starting from location x4000. In class, we discussed using a HEAD and a TAIL pointer to keep track of the beginning and end of the queue. In fact, we suggested that the HEAD pointer could point to the first element that we would remove from the queue and the TAIL pointer could point the last element that we have added the queue. It turns out that our suggestion does not work.

Part a) What is wrong with our suggestion? (Hint: how do we check if the queue is full? How do we check if it is empty?)

Part b) What simple change could be made to our queue to resolve this problem?

Part c) Using your correction, write a few instructions that check if the queue is full. Use R3 for the HEAD pointer and R4 for the TAIL pointer.

Part d) Using your correction, write a few instructions that check if the queue is empty. Again, using R3 for the HEAD pointer and R4 for the TAIL pointer.

In: Computer Science

Balancing Redox Equations in Acidic or Basic Solutions In addition to mass balance, oxidation-reduction reactions must...

Balancing Redox Equations in Acidic or Basic Solutions

In addition to mass balance, oxidation-reduction reactions must be balanced such that the number of electrons lost in the oxidation equals the number of electrons gained in the reduction. This balancing can be done by two methods. The oxidation number method balances the net increase in oxidation of the substance oxidized with the net decrease in the oxidation number of the substance reduced. The half-reaction method balances the electrons lost in the oxidation half-reaction with the electrons gained in the reduction half-reaction. In both methods

H2O(l),OH?(aq), and H+ (aq) may be added to complete the mass balance. Which substances are used depends on the reaction conditions.

Acidic solution

In acidic solution, bromate ion can be used to react with a number of metal ions. One such reaction is

BrO3?(aq)+Sn2+(aq)?Br?(aq)+Sn4+(aq)

Since this reaction takes place in acidic solution,

H2O(l)andH+(aq) will be involved in the reaction. Places for these species are indicated by the blanks in the following restatement of the equation:

BrO3?(aq)+Sn2+(aq)+ ____ ?Br?(aq)+Sn4+(aq)+ ___

Part A

What are the coefficients of the six species in the balanced equation above? Remember to include coefficients for

H2O(l)andH+(aq)

in the appropriate blanks.

Enter the equation coefficients in order separated by commas (e.g., 2,2,1,4,4,3).

     

Basic solution

Potassium permanganate,

KMnO4, is a powerful oxidizing agent. The products of a given redox reaction with the permanganate ion depend on the reaction conditions used. In basic solution, the following equation represents the reaction of this ion with a solution containing sodium sulfite:

MnO4?(aq)+SO32?(aq)?MnO2(s)+SO42?(aq)Since this reaction takes place in basic solution,H2O(l)andOH?(aq)

will be shown in the reaction. Places for these species are indicated by the blanks in the following restatement of the equation:

MnO4?(aq)+SO32?(aq)+ ____?MnO2(s)+SO42?(aq)+ ___

Part B

What are the coefficients of the six species in the balanced equation above? Remember to include coefficients for

H2O(l)andOH? (aq) in the blanks where appropriate.

Enter the equation coefficients in order separated by commas (e.g., 2,2,1,4,4,3).

In: Chemistry