Solved-Homework 1- Solution

$30.00 $19.00

Please refer to Blackboard (at the top of Course Materials) for submission guidelines. Problem 1 (25 points)-­‐True/False Submit a document called Answers.doc Answer the following true/false questions using the code that follows. You must correctly state WHY your answer is true or false in order to receive credit. Put your answers in a document called…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

Please refer to Blackboard (at the top of Course Materials) for submission guidelines.

Problem 1 (25 points)-­‐True/False Submit a document called Answers.doc

Answer the following true/false questions using the code that follows. You must correctly

state WHY your answer is true or false in order to receive credit. Put your answers in a document called Answers.doc.

  1. The function printf is defined in this program.

  1. This code includes one header and two preprocessor directives.

  1. argc is a function.

  1. If we removed the line #include <string.h>, the program would still run.

  2. If we removed the line #include <stdio.h>, the program would still run.

#include <stdio.h>

#include <string.h>

int main (int argc, char **argv)

{

int grade;

int i=0;

while(i==0)

{

printf(“Enter grade: “);

scanf(“%d”, &grade);

if(grade<0||grade>=100)/*not valid grade*/

{

printf(“Not a valid grade.\n”);

}

else/*valid grade*/

{

i=1;

}

}

/*how many points away from a 100?*/

int value=100-­‐grade;

if(value==1)

{

printf(“You are 1 point away from a 100.\n”);

}

else

{

printf(“You are %d points away from a 100.\n”, value);

}

}

Problem 2 (75 points)-­‐Write a program.

ABC Home Health Company prefers to have Medicare patients since they find the reimbursement (payment) structure is easier to handle. Its marketing team is creating a campaign to target hospitals with higher numbers of Medicare patients. The company has asked you to create a program that would allow it to compare any two hospitals and determine which of the two is a better candidate for its marketing campaign.

-­‐-­‐-­‐-­‐-­‐-­‐-­‐

Sample Run 1:

Number of patients in hospital 1: 2

Enter age of patient 1: 45

Enter age of patient 2: 67

Number of patients in hospital 2: 3

Enter age of patient 1: 34

Enter age of patient 2: 90

Enter age of patient 3: 100

You should pick hospital 2-­‐they have more Medicare patients.

-­‐-­‐-­‐-­‐-­‐-­‐-­‐

Sample Run 2:

Number of patients in hospital 1: 3

Enter age of patient 1: 45

Enter age of patient 2: 67

Enter age of patient 3: 67

Number of patients in hospital 2: 3

Enter age of patient 1: 34

Enter age of patient 2: 90

Enter age of patient 3: 100

They have the same number of Medicare patients-­‐go for either.

-­‐-­‐-­‐-­‐-­‐-­‐-­‐

  1. (15 points) Include this in Answers.doc from problem 1

Break down the given problem into smaller subtasks. You are not required to use the diagraming technique we did in class, but you need to show your approach to the problem along with your thinking process.

  1. (10 points) Include this in Answers.doc from problem 1

Write a function declaration (NOT DEFINITION) for each smaller subtask you created in part a. Indicate the significance/reasons for any parameters you decide to use.

  1. (50 points) Submit a file called medicare.c

Define the functions you declared in part b and write the program. 0 points if you code everything in main or do not define the same functions declared in part b.