Questions
You will update the program as follows: [8 marks] Define the TimeType and DateType data types....

You will update the program as follows:
[8 marks] Define the TimeType and DateType data types. The content of these data types can be deduced from a thorough reading of the base code.
[6 marks] Complete the implementation of the initDate() function.
[16 marks] Write the complete implementation of the selectTimes() function. This function populates the newArr parameter with all the dates in arr that have a time earlier than the given hours and minutes. For example, if the cut-off time specified is 14 hours and 30 minutes, newArr will contain all the dates with a time before 2:30 pm.


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX_STR_1 16
#define MAX_STR_2 32
#define MAX_ARR 64
#define C_OK 0
#define C_NOK -1

typedef struct {
/* TimeType not shown */
} TimeType;

typedef struct {
/* DateType not shown */
} DateType;

typedef struct {
int size;
DateType* elements[MAX_ARR];
} ArrayType;

void initArray(ArrayType*);
void addDate(ArrayType*, DateType*);
void selectTimes(ArrayType*, ArrayType*, int, int);
void initDate(char*, int, int, int, int, int, DateType*);
void printArray(ArrayType*);
void printDate(DateType*);

int main()
{
ArrayType calendar, specialCal;
DateType* newDate;
int num1, num2, num3, num4, num5;
char str[MAX_STR_1];

initArray(&calendar);
initArray(&specialCal);

while(1) {
printf("Enter month, day, year, hours, minutes, and seconds: ");
scanf("%s %d %d %d %d %d", str, &num1, &num2, &num3, &num4, &num5);
if (strcmp(str, "-1") == 0)
break;
newDate = malloc(sizeof(DateType));
initDate(str, num1, num2, num3, num4, num5, newDate);
addDate(&calendar, newDate);
}

printf("Enter cut-off time (hours and minutes): ");
scanf("%d %d", &num1, &num2);
selectTimes(&calendar, &specialCal, num1, num2);

printf(" FULL CALENDAR:");
printArray(&calendar);

printf(" MORNING CALENDAR:");
printArray(&specialCal);

return(0);
}

/*
Purpose: initialize an array structure
*/
void initArray(ArrayType *a) { a->size = 0; }

/*
Purpose: populate newArr with all dates from orgArr that have
a time before the given hours and minutes, for
example, if we want a calendar with all the morning
appointments, we would call this function with
h and m parameters set to 12 and 0, respectively
*/
void selectTimes(ArrayType *orgArr, ArrayType *newArr, int h, int m)
{
/* Implementation not shown */
}

/*
Purpose: add a date structure to the back of the array
*/
void addDate(ArrayType *arr, DateType *newDate)
{
if (arr->size >= MAX_ARR)
return;

arr->elements[arr->size] = newDate;
++(arr->size);
}

/*
Purpose: initialize a date structure with the given parameters
*/
void initDate(char *mm, int d, int y, int h, int m, int s, DateType *newDate)
{
/* Implementation not shown */
}

void printDate(DateType *d)
{
char str[MAX_STR_2];

sprintf(str, "%s %d, %d", d->month, d->day, d->year);

printf("%25s @ %2d:%2d:%2d ", str,
d->time.hours, d->time.minutes, d->time.seconds);

}

void printArray(ArrayType *arr)
{
int i;

printf(" ");

for (i=0; i<arr->size; ++i)
printDate(arr->elements[i]);
}

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

Problem 1 In 1960 Botswana’s PPP adjusted GDP per capita was $990 and Brazil’s was $2440....

Problem 1

In 1960 Botswana’s PPP adjusted GDP per capita was $990 and Brazil’s was $2440. Brazil is growing at a rate of 1% per annum, while Botswana is growing rapidly and equaled Brazil’s income level by 2000. What was the growth rate of Botswana?

Problem 2

In 1960 the population of Bangladesh was 50 million and in 2000 it was 130 million.
a. What was the population growth rate between 1960 and 2000?

b. At this rate, in which year will Bangladesh’s population reach 300 million?

c. The current population of Bangladesh is 165 million. What is average annual growth rate between 2000 and 2017?

d. What is the average annual growth rate over the 57-year period from 1960 to 2017?

In: Economics

The Sofa Ltd manufactures luxurious indoor furniture. The company requires analysis of its financial position and,...

The Sofa Ltd manufactures luxurious indoor furniture. The company requires analysis of its financial position and, in particular, to assess the management of current assets and the use of debts.

The draft financial statements for 2018 and 2017 are presented below:

The Sofa Ltd

Statement of profit and loss and other comprehensive income for the year ended 31 August 2018

2018 2017

Sales(all sales are on credit) 8 532 000 7 425 000

Cost of sales (6 399 000) (5 494 500)

Gross profit 2 133 000 1 930 500

Operating expenses (1 344 600) (1 174 500)

Operating profit before interest expenses and taxation 788 400 756 000

Interest expense (243 000) (148 500)

Net profit before taxation 545 400 607 500

Taxation (243 000) (216 000)

Net profit before extraordinary loss 302 400 391 500

Extraordinary loss (108 000) 0

Net profit attributable to ordinary shareholders 194 400 391 500

Preference dividend paid (32 400) (32 400)

Ordinary dividend paid (40 500) (40 500)

Retained profit (loss) for the year 121 500 318 600

Retained profit-beginning of the year 837 000 518 400

Retained profit-end of year 958 500 837 000

THE SOFA LTD

Statement of financial position

2018 2017

Non current assets 945 000 864 000

Property, plant and equipment 945 000 864 000

Current assets 3 604 500 2 963 250

Inventories 2 092 500 1 485 000

Accounts receivable 1 215 000 999 000

Cash and cash equivalents 297 000 479 250

TOTAL ASSETS 4 549 500 3 827 250

EQUITY AND LIABILITIES

Capital and reserves 1 903 500 1 782 000

Ordinary share capital 675 000 675 000

Retained profit 958 500 837 000

Redeemable preference share capital 270 000 270 000

Non current liabilities 742 500 742 500

Long-term borrowings 742 500 742 500

Current liabilities 1 903 500 1 302 750

Short-term borrowings 1 417 500 870 750

Accounts payable 486 000 432 000

TOTAL EQUITY AND LIABILITIES 4 549 500 3 827 250

Additional Information:

The company's share capital consists of 675 000 shares of N$1 each (market value N$4.70).
The preference shares are redeemable on 1 September 2019.
Industry ratios for 2018:
Current ratio 2:1
Acid test (quick) ratio 1:1
Inventory turnover (sales/inventory) 6 times
Accounts receivable collection period 40 days
Debt ratio 59%
Time interest earned 6 times


A) Calculate and explain the relevant ratios for 2018 and 2017 to analyze the company's liquidity position and management of current assets.

B) Calculate and explain the relevant ratios for 2018 and 2017 to analyze the company's use of debt to finance its operations.

C) Calculate the company's earnings and dividend yields for 2018.

In: Accounting

Find the human hemoglobin subunit alpha protein on PDB (Protein Data Bank) protein database. Hint: You...

Find the human hemoglobin subunit alpha protein on PDB (Protein Data Bank) protein database. Hint: You can use also use PDB identifier “5HU6” to find human hemoglobin subunit alpha protein on PDB database.

(a) Find the Experimental Data section on this protein page and report Method and Resolution used?

(b) Find the Entry History section on this protein page and report Deposited Date and Deposition author(s)?

(c) Find the secondary structure information for this protein structure. What secondary structure types does this protein contain?

(d) How many helices are there? How many beta strands are there?

(e) Download the FASTA Sequence and Copy/Paste the sequence information from the downloaded file

(f) Click 3D View tab and view the protein structure in 3D. Then, take a screenshot of the Protein structure on the viewer and provide the screenshot

(g) Click the Sequence Similarity tab and write down how many sequences on PDB database are 70% or more similar to hemoglobin subunit alpha( it is the number is shown under “Chains in Cluster”)

In: Biology

Confirmed Cases CA: 18517, 3315, 2826, 2018, 1845, 1666, 1401, 1340, 1019 Confirmed Cases WA: 5637,...

Confirmed Cases CA: 18517, 3315, 2826, 2018, 1845, 1666, 1401, 1340, 1019

Confirmed Cases WA: 5637, 2243, 1212, 923, 383, 330, 293, 283, 282

The data you are being provided with relates to information collected about the current COVID-19 pandemic. You are being asked to analyze this “case” data.

Hypothesis Test Conclusion (i.e. Does score fall into the region of rejection; “significant” or “non-significant”; retain or reject Null, etc.; show probability equation found in the research literature)?

Hypothesis Test Conclusion

The proper conclusion of statistical results using appropriate statistical terminology.

In: Statistics and Probability

Which, if any, of the following, is subject to an overall limitation on meals in 2018?...

Which, if any, of the following, is subject to an overall limitation on meals in 2018?

a. Meals provided to employees during a business meeting.

b. Meals provided at cost to employees by a cafeteria funded by the employer.

c. Fourth of July company picnic for employees.

d. Meals provided to employees during a training event or retreat at an off-site location.

e. All of these.

Which, if any, of the following expenses, are deductible?

a. Safety shoes purchased by a plumber employed by a company.

b. Bottled water purchased by a gig driver for passengers.

c. Unreimbursed employee expenses.

d. Tax return preparation fee paid by a non-employed retiree.

e. None of these

In: Accounting

On December 31, 2017, Laner Inc, acquired a machine from Rocky Corporation by insuing a $600,000,...

On December 31, 2017, Laner Inc, acquired a machine from Rocky Corporation by insuing a $600,000, non-interest-bearing note that is payable in full on December 31, 2021. The company's credit rating permits it to borrow funds from its severni lines of credit at 10% The machine is expected to have a five year life and a $70,000 residual value la) Calculate the value of the note and prepare the journal entry for the purchase on

December 31, 2017. 2 Marks () Prepare any necessary adjusting entries related to depreciation of the asset (use straight line) and amortization of the note fuse the effective interest method on December 31, 2018.

In: Accounting

On December 31, 2017, Laser Inc. acquired a machine from Rocky Corporation by issuing a $600,000,...

On December 31, 2017, Laser Inc. acquired a machine from Rocky Corporation by issuing a $600,000, non–interest-bearing note that is payable in full on December 31, 2021. The company’s credit rating permits it to borrow funds from its several lines of credit at 10%. The machine is expected to have a five-year life and a $70,000 residual value.
(a) Calculate the value of the note and prepare the journal entry for the purchase on December 31, 2017. [2 Marks]
(b) Prepare any necessary adjusting entries related to depreciation of the asset (use straight-line) and amortization of the note (use the effective interest method) on December 31, 2018.

In: Accounting

In a monetary policy move at the end of 2016, the U.S Federal Reserve Bank, the...

In a monetary policy move at the end of 2016, the U.S Federal Reserve Bank, the country’s central bank raised interest rate citing a stronger economic growth and rising employment. Here in Asia, currencies have generally been weakening against the US dollar as money has flown out of Asia and into the dollar.

Sources: BBC News, 15 & 16 December 2018

a) How have the Asian countries been affected by the increase in the U.S. interest rates?

b) In the absence of government intervention in Asian countries to the increase in U.S. interest rates, identify and explain two possible beneficial and two non-beneficial effects on the economy.

In: Economics