"Software and System Standards" Please respond to the following:
Describe system and software standards that could be used for the description of control constructs in C, C#, or Java.
Explain how software standards are used to improve the quality of software in an organization. Provide examples to support your answer.
Control structures form the basic entities of a “structured programming language“. We all know languages like C/C++ or Java are all structured programming languages. Control structures are used to alter the flow of execution of the program. Why do we need to alter the program flow ? The reason is “decision making“! In life, we may be given with a set of option like doing “Electronics” or “Computer science”. We do make a decision by analyzing certain conditions (like our personal interest, scope of job opportunities etc). With the decision we make, we alter the flow of our life’s direction. This is exactly what happens in a C/C++ program. We use control structures to make decisions and alter the direction of program flow in one or the other path(s) available.
There are three types of control structures available in C and C++
1) Sequence structure (straight line paths)
2) Selection structure (one or many branches)
3)Loop structure (repetition of a set of activities)
All the 3 control structures and its flow of execution is represented in the flow charts given below.
Control statements in C/C++ to implement control structures
We have to keep in mind one important fact:- all program processes can be implemented with these 3 control structures only. That’s why I wrote “control structures are the basic entities of a structured programming language“. To implements these “control structures” in a C/C++ program, the language provides ‘control statements’. So to implement a particular control structure in a programming language, we need to learn how to use the relevant control statements in that particular language.
The control statements are:-
Switch
If
If Else
While
Do While
For
As shown in the flow charts:-
Selection structures are implemented using If , If Else and Switch statements.
Looping structures are implemented using While, Do While and For statements.
Selection structures
Selection structures are used to perform ‘decision making‘ and then branch the program flow based on the outcome of decision making. Selection structures are implemented in C/C++ with If, If Else and Switch statements. If and If Else statements are 2 way branching statements where as Switch is a multi branching statement.
The simple If statement
The syntax format of a simple if statement is as shown below.
if (expression) // This expression is evaluated. If expression is TRUE statements inside the braces will be executed
{
statement 1;
statement 2;
}
statement 1;// Program control is transfered directly to this line, if the expression is FALSE
statement 2;
The expression given inside the brackets after if is evaluated first. If the expression is true, then statements inside the curly braces that follow if(expression) will be executed. If the expression is false, the statements inside curly braces will not be executed and program control goes directly to statements after curly braces.
Example program to demo “If” statement
Problem:-
A simple example program to demo the use of If, If Else and Switch is shown here. An integer value is collected from user.
If the integer entered by user is 1 – output on screen “UNITED STATES”. If the integer is 2 – output “SPAIN”, If the integer is 3 output “INDIA”. If the user enters some other value – output “WRONG ENTRY”.
Note:- The same problem is used to develop example programs for “if else” and “switch” statements
#include
void main()
{
int num;
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
if(num==1)
{
printf("UNITED STATES");
}
if(num==2)
{
printf("SPAIN");
}
if(num==3)
{
printf("INDIA");
}
}
The If Else statement.
Syntax format for If Else statement is shown below.
if(expression 1)// Expression 1 is evaluated. If TRUE, statements inside the curly braces are executed.
{ //If FALSE program control is transferred to immedate else if statement.
statement 1;
statement 2;
}
else if(expression 2)// If expression 1 is FALSE, expression 2 is evaluated.
{
statement 1;
statement 2;
}
else if(expression 3) // If expression 2 is FALSE, expression 3 is evaluated
{
statement 1;
statement 2;
}
else // If all expressions (1, 2 and 3) are FALSE, the statements that follow this else (inside curly braces) is executed.
{
statement 1;
statement 2;
}
other statements;
The execution begins by evaluation expression 1. If it is TRUE, then statements inside the immediate curly braces is evaluated. If it is FALSE, program control is transferred directly to immediate else if statement. Here expression 2 is evaluated for TRUE or FALSE. The process continues. If all expressions inside the different if and else if statements are FALSE, then the last else statement (without any expression) is executed along with the statements 1 and 2 inside the curly braces of last else statement.
Example program to demo “If Else”
#include
void main()
{
int num;
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
if(num==1)
{
printf("UNITED STATES");
}
else if(num==2)
{
printf("SPAIN");
}
else if(num==3)
{
printf("INDIA");
}
else
{
printf("WRONG ENTRY"); // See how else is used to output "WRONG ENTRY"
}
}
Note:- Notice how the use of If Else statements made program writing easier. Compare this with above program using simple If statement only.
Switch statement
Switch is a multi branching control statement. Syntax for switch statement is shown below.
switch(expression)// Expression is evaluated. The outcome of the expression should be an integer or a character constant
{
case value1: // case is the keyword used to match the integer/character constant from expression.
//value1, value2 ... are different possible values that can come in expression
statement 1;
statement 2;
break; // break is a keyword used to break the program control from switch block.
case value2:
statement 1;
statement 2;
break;
default: // default is a keyword used to execute a set of statements inside switch, if no case values match the expression value.
statement 1;
statement 2;
break;
}
Execution of switch statement begins by evaluating the expression inside the switch keyword brackets. The expression should be an integer (1, 2, 100, 57 etc ) or a character constant like ‘a’, ‘b’ etc. This expression’s value is then matched with each case values. There can be any number of case values inside a switch statements block. If first case value is not matched with the expression value, program control moves to next case value and so on. When a case value matches with expression value, the statements that belong to a particular case value are executed.
Notice that last set of lines that begins with default. The word default is a keyword in C/C++. When used inside switch block, it is intended to execute a set of statements, if no case values matches with expression value. So if no case values are matched with expression value, the set of statements that follow default: will get executed.
Note: Notice the break statement used at the end of each case values set of statements. The word break is a keyword in C/C++ used to break from a block of curly braces. The switch block has two curly braces { }. The keyword break causes program control to exit from switch block.
Example program to demo working of “switch”
#include
void main()
{
int num;
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
switch(num)
{
case 1:
printf("UNITED STATES");
break;
case 2:
printf("SPAIN");
break;
case 3:
printf("INDIA");
default:
printf("WRONG ENTRY");
}
}
Note:- Switch statement is used for multiple branching. The same can be implemented using nested “If Else” statements. But use of nested if else statements make program writing tedious and complex. Switch makes it much easier. Compare this program with above one.
A loop structure is used to execute a certain set of actions for a predefined number of times or until a particular condition is satisfied. There are 3 control statements available in C/C++ to implement loop structures. While, Do while and For statements.
The while statement
Syntax for while loop is shown below:
while(condition)// This condition is tested for TRUE or FALSE.
Statements inside curly braces are executed as long as condition is
TRUE
{
statement 1;
statement 2;
statement 3;
}
The condition is checked for TRUE first. If it is TRUE then all statements inside curly braces are executed.Then program control comes back to check the condition has changed or to check if it is still TRUE. The statements inside braces are executed repeatedly, as long as the condition is TRUE. When the condition turns FALSE, program control exits from while loop.
Note:- while is an entry controlled loop. Statement inside braces are allowed to execute only if condition inside while is TRUE.
Example program to demo working of “while loop”
An example program to collect a number from user and then print all numbers from zero to that particular collected number is shown below. That is, if user enters 10 as input, then numbers from 0 to 10 will be printed on screen.
Note:- The same problem is used to develop programs for do while and for loops
#include
void main()
{
int num;
int count=0; // count is initialized as zero to start printing from
zero.
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
while(count<=num) // Checks the condition - if value of count
has reached value of num or not. { printf("%d",count);
count=count+1; // value of count is incremented by 1 to print next
number. } }
The do while statement
Syntax for do while loop is shown below:
do
{
statement 1;
statement 2;
statement 3;
}
while(condition);
Unlike while, do while is an exit controlled loop. Here the set of statements inside braces are executed first. The condition inside while is checked only after finishing the first time execution of statements inside braces. If the condition is TRUE, then statements are executed again. This process continues as long as condition is TRUE. Program control exits the loop once the condition turns FALSE.
Example program to demo working of "do while"
#include
void main()
{
int num;
int count=0; // count is initialized as zero to start printing from
zero.
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
do
{
printf("%d",count); // Here value of count is printed for one time
intially and then only condition is checked.
count=count+1; // value of count is incremented by 1 to print next
number.
}while(count<=num); }
The for statement
Syntax of for statement is shown below:
for(initialization statements;test condition;iteration
statements)
{
statement 1;
statement 2;
statement 3;
}
The for statement is an entry controlled loop. The difference between while and for is in the number of repetitions. The for loop is used when an action is to be executed for a predefined number of times. The while loop is used when the number of repetitions is not predefined.
Working of for loop:
The program control enters the for loop. At first it execute the statements given as initialization statements. Then the condition statement is evaluated. If conditions are TRUE, then the block of statements inside curly braces is executed. After executing curly brace statements fully, the control moves to the "iteration" statements. After executing iteration statements, control comes back to condition statements. Condition statements are evaluated again for TRUE or FALSE. If TRUE the curly brace statements are executed. This process continues until the condition turns FALSE.
Note 1:- The statements given as
"initialization statements" are executed
only once, at the beginning of a for loop.
Note 2: There are 3 statements given to a for loop
as shown. One for initialization purpose, other for condition
testing and last one for iterating the loop. Each of these 3
statements are separated by semicolons.
Example program to demo working of "for loop"
#include
void main()
{
int num,count;
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
for(count=0;count<=num;count++)// count is initialized to zero
inside for statement. The condition is checked and statements are
executed. { printf("%d",count); // Values from 0 are printed. }
}
An Example
Let us analyze flow control by using traffic flow as a model. A vehicle is arriving at an intersection. Thus, the precondition is the vehicle is in motion. Suppose the traffic light at the intersection is red. The control structure must determine the proper course of action to assign to the vehicle.
Precondition: The vehicle is in motion.
Treatments of Information through Control Structures
Is the traffic light green? If so, then the vehicle may stay in motion.
Is the traffic light red? If so, then the vehicle must stop.
End of Treatment
Postcondition: The vehicle comes to a stop.
Thus, upon exiting the control structure, the vehicle is stopped.
can also be form as a structure
IF-THEN Statement
The IF-THEN statement is a simple control that tests whether a condition is true or false. The condition can include a variable, or be a variable. If the variable is an integer 2, it will be true, because any number that is not zero will be true. If the condition is true, then an action occurs. If the condition is false, nothing is done. To illustrate:
IF variable is true
THEN take this course of action.
If the variable indeed holds a value consistent with being true, then the course of action is taken. If the variable is not true, then there is no course of action taken.
IF-THEN-ELSE Statement
IF-THEN statements test for only one action. With an IF-THEN-ELSE statement, the control can "look both ways" so to speak, and take a secondary course of action. If the condition is true, then an action occurs. If the condition is false, take an alternate action. To illustrate:
IF variable is true
THEN take this course of action
ELSE call another routine
In this case, if the variable is true, it takes a certain course of action and completely skips the ELSE clause. If the variable is false, the control structure calls a routine and completely skips the THEN clause.
Note that you can combine ELSE's with other IF's, allowing several tests to be made. In an IF-THEN-ELSEIF-THEN-ELSEIF-THEN-ELSEIF-THEN structure, tests will stop as soon as a condition is true. That's why you'd probably want to put the most "likely" test first, for efficiency (Remembering that ELSE's are skipped if the first condition is true, meaning that the remaining portions of the IF-THEN-ELSEIF... would not be processed). eg:
In case your computer doesn't start
IF a floppy disk is in the drive
THEN remove it and restart
ELSE IF you don't have any OS installed
THEN install an OS
ELSE call the hotline
You can have as many ELSE IF's as you like.
WHILE and DO-WHILE Loops
A WHILE loop is a process in which a loop is initiated until a condition has been met. This structure is useful when performing iterative instructions to satisfy a certain parameter. To illustrate:
Precondition: variable X is equal to 1
WHILE X is not equal to 9
Add 1 to X
This routine will add 1 to X until X is equal to 9, at which point the control structure will quit and move on to the next instruction. Note that when the structure quits, it will not execute the Add function: when X is equal to 9, it will skip over the clause that is attached to the WHILE. This instruction is useful if a parameter needs to be tested repeatedly before acceptance.
DO-WHILE Loops
A DO-WHILE loop is nearly the exact opposite to a WHILE loop. A WHILE loop initially checks to see if the parameters have been satisfied before executing an instruction. A DO-WHILE loop executes the instruction before checking the parameters. To illustrate:
DO Add 1 to X
WHILE X is not equal 9
As you can see, the example differs from the first illustration, where the DO action is taken before the WHILE. The WHILE is inclusive in the DO. As such, if the WHILE results in a false (X is equal to 9), the control structure will break and will not perform another DO. Note that if X is equal to or greater than 9 prior to entering the DO-WHILE loop, then the loop will never terminate.
FOR Loops
A FOR loop is an extension of a while loop. A for loop usually has three commands. The first is used to set a starting point (like x = 0). The second is the end condition (same as in a while loop) and is run every round. The third is also run every round and is usually used to modify a value used in the condition block.
FOR X is 0. X is less than 10. add 1 to X.
This loop would be run 10 times (x being 0 to 9) so you won't have to think about the X variable in the loop you can just put code there. Here is a while loop that does the same:
X is 0
WHILE X is less than 10
add 1 to X
Some programming languages also have a foreach loop which will be useful when working with arrays (and collections). A foreach loop is an even more automated while loop that cycles through array's and such. Example :
FOREACH student IN students
give a good mark to student
"Software and System Standards" Please respond to the following: Describe system and software standards that could...
Could you please give a description of quailty control tools that a health services organization or one with which you are familiar uses for process analysis. Be specific and provide examples. Then, create your own example of this tool, and attach it to your discussion. Do not use real data. Describe the strengths and weaknesses of the tool for process analysis in health care administration, and explain why.
Part 1: Please describe one example of information technology that you use for your role in your organization. Your description should include the business functions that are supported by the technology, the technology infrastructure (platform) on which it operates, and the types of data that are captured or produced by the system. Next describe the benefits provided by the system. Does it automate manual processes, to reduce the labor costs required for the process? Does it support business decisions to...
Describe a nonmanufacturing business that could benefit from the use of standards. Also explain how standards would help that business control its operations.
What are the differences between utility software and application software? Please describe it in detail and provide a few examples. A software developer has built software that plays video and music. She wants to provide this software to the user for free of charge but wants to have the copyright of the software. Which software licensing software should she use and why? List the different type of software licensing and how the buyer can use it? Multiprocessing and Parallel processing...
Please respond to the following questions based upon these course objectives: Compare the various laws that affect health care organizations (e.g., HIPAA, EMTALA, ADA). Identify examples of Medicaid and Medicare fraud and abuse. Demonstrate the translation and interpretation of health information for consumers and advocates. Manage access and disclosure for the release of protected health information. Design and implement confidentiality agreements, and monitor their impact on the health care organization. Apply and promote ethical standards of practice by applying the...
"Knowledge Management" Please respond to the following: Briefly in your own words describe the distinction between explicit knowledge and implicit (tacit) knowledge. Next describe the knowledge network cycle that transforms individual knowledge into organizational knowledge. Be sure to identify any key transformations within your response. Discuss two (2) fundamental challenges of data storage and information sharing associated with a company’s knowledge management system. Next hypothesize how one would overcome the problem of “not knowing what you know.” Provide support for...
Please respond to the following discussion prompts. 1. Describe some of the diet and health connections between a child and a senior citizen? Provide examples.
Completely and thoroughly explain how a Predetermined Time System, such as MTM or MOST, could be used to establish labor standards for a company that makes any type of metal products. Be specific in your answer and identify as many different specific examples as you can where a Predetermined Time System could be used to establish engineered standards for the different operations that are required to make any type of metal products
Question #1 CL0:12 Marks: 5 Explain the following: Software Configuration Management and how it is important in the change management process • Code Refactoring • Main Phases and Activities of IEEE Standards Question #2 CL0: 3 Marks: 5 Please provide a description of at least 2 tools of Software Evolution and 2 tools of Software Maintenance, please provide the following details of the tools: - Description of the tools - Working of the tools (how they work) - Screenshots of...
Is the OS the primary piece of software responsible for the security of the overall system? Explain your answer and give examples to support your conclusion. How does this affect confidentiality, integrity, and availability for the system? Which of these factors is most influenced by the OS?