SlideShare a Scribd company logo
1 of 11
Overview:
This hands-on lab allows you to follow and experiment with the
critical steps of developing a program including the program
description, Analysis, , Design(program design, pseudocode),
Test Plan, and implementation with C code. The example
provided uses sequential, repetition statements and nested
repetition statements.
Program Description:
This program will calculate the average of 10 positive integers.
The program will ask the user to 10 integers. If any of the
values entered is negative, a message will be displayed asking
the user to enter a value greater than 0. The program will use a
loop to input the data.
Analysis:
I will use sequential, selection and repetition programming
statements.
The program will loop for 10 positive numbers, prompting the
user to enter a number.
I will define three integer variables: count, value and sum.
count will store how many times values greater than 0 are
entered. value will store the input. Sum will store the sum of all
10 integers.
I will define one double number: avg. avg will store the average
of the ten positive integers input.
The sum will be calculated by this formula: sum = sum + value
For example, if the first value entered was 4 and second was 10:
sum = sum + value = 0 + 4
sum = 4 + 10 = 14
Values and sum can be input and calculated within a repetition
loop: while count <10
Input value
sum = sum + value End while
Avg can be calculated by: avg = value/count
A selection statement can be used inside the loop to make sure
the input value is positive.
If value >= 0 then count = count + 1 sum = sum + value
Else
input value End If
(
7
)
Program Design:
Main
// This program will calculate the average of 10 integer numbers
// Declare variables
// Initialize variables
// Loop through 10 numbers
// Prompt for positive integer
// Get input
// test input value for gt 0 if (value > 0)
//Increment counter
//Accumulate sum Else
// display msg to enter a positive integer
// Prompt for positive integer
// Get input Endif
// End loop
//Calculate average
//Print the results (average)
End
Test Plan:
To verify this program is working properly the input values
could be used for testing:
Test Case
Input
Expected Output
1
1 1 1 0 1
2 0 1 3 2
Average = 1.2
2
100 100 100 100 -100
Input a positive value
100 200 -200 200 200
Input a positive value
200 200
average is 120.0
NOTE: test #2 has 12 input numbers because there are two
negative numbers.
Pseudocode: Main
// This program will calculate the average of 10 positive
integers.
// Declare variables
Declare count, value, sum as Integer Declare avg as double
//Initialize values
Set count=0 Set sum = 0 Set avg = 0.0;
// Loop through 10 integers While count < 10
Input value
If (value >=0)
sum = sum + value count=count+1
Else
Pr *** Value must be positive *** Input value
End if End While
// Calculate average avg = sum/count
// Print results
End //End of Main
C Code
The following is the C Code that will compile in execute in the
online compilers.
#include <stdio.h>
#include <stdbool.h> // needed for the Boolean variable
debug.
int main ()
{
/* variable definition: */ int count, value, sum; float avg;
bool debug;
/* Initialize */ count = 0;
sum = 0;
avg = 0.0; debug = false;
// Loop through to input values while (count < 10)
{
printf("Enter a positive Integern"); scanf("%d", &value);
if (debug) printf(" value is %dn " , value ); //note the value
of debug if (value >= 0) {
sum = sum + value; count = count + 1;
}
else {
printf("Value must be positiven");
}
}
// Calculate avg.
// Since sum and count are both integers, this will give you an
integer division
// Hence, we need to either
// Declare sum as a float or...
// type cast sum as float (as shown below) avg = (float)
sum/count;
printf("sum is %dn", sum); printf("average is %fn " , avg );
return 0;
}
Setting up the code and the input parameters in ideone.com:
Note the input integer values are 1, 1, 1, 0, 1, 2, 0, 1, 3, 2 for
this test case.
You can change these values to any valid integer values to
match your test cases.
You should also test with a negative number to make sure the
positive integer logic works properly.
Note: the input data needs to be entered into the stdin window
separated by a space of new line.
Results from running the programming at ideone.com:
Learning Exercises for you to try:
1. Change the code to average 20 integers as opposed to 10.
Support your experimentation with screen captures
of executing the new code. What happens if you change the
formatter to %.2f printf("average is %.2fn " , avg );
2. What happens if you entered a value other than an integer?
(For example a float or even a string). Support your
experimentation with screen captures of executing the code. To
help in your analysis try as input 1 2 3 a 4 5 Hint: activate this
line if(debug) printf(" value is %dn " , value ); after the scanf
statement that reads in the value. Activate by changing the
value of debug.
Next try as input 1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.5
What happens?
3. Modify the code to allow the user to enter an unspecified
number of positive integers and calculate the average. In other
words, the user could enter any number of positive integers.
(Hint: You can prompt the user for how many they want to
enter. Or; you could use a sentinel value to trigger when the
user has completed entering values). You may need to conduct
some research on your own to solve this problem.
4. Prepare a new test table with at least 3 distinct test cases
listing input and expected output for the code you created.
Support your experimentation with screen captures of executing
the new code.
Loop (Repetition) with Nested selection n
statement
v Hide Description
(
10/3/2016
) (
Loop
(Repetition)
with
Nested
selection
statement
-
CMIS
102
6386
Introduction
to
Problem
Solving
and
Algorithm
Design
(2168)
)
Whne {Cost > 0) If (Cost > 150)
If (Staff > 12)
Fee = 110
Else
Fee = 115
Endlf
NESTED LOOPS, Ifs
Else
Fee = 12.0,
nplf
EndWhi le
Part 1:
Create a While-End repetition structure that includes a nested
if-then selection structure. Provide an overview (i.e. Program
Design) of what your repetition structure is doing as well as the
Pseudocode.
Create a program that handles 150 passengers of an Airline with
the following requirements: The first 25 passenger the ticket
price is $90. The remaining passengers the ticket price is $100.
The first 100 passengers get a ticket. The next 25 (i.e 101-
125) are put on standby. No more passengers are accepted after
125. Print out a message for each of the above categories .
Part 2:
Convert Discussion 1 to C-code. Don't for get to indent your
code. Put Discussion 2 - problem no.X in the Subject area and
submit a .txt (or .c) file for your code.
1/2
CurrDate (i.e. 2016mmdd)
StartDate (i.e. 2016mmdd) // Mon start of week EndDate (i.e.
2016mmdd) // Sun end of week maxRecs 37 II the number of
data records
Here is what you have to work with. Don't worry about writing
the data, just setting the background color. Hint: you need to
compare the Date variables : CurrDate , StartDate, EndDate.
What is special about the Yellow background ? To set the Beige
background you need to work with prevYear and Year - Year
you determine from CurrDate, prevYear you need to set in your
loop appropriately.
Declare CurrDate, StartDate, EndDate, Year, prevYear,
maxRecs, recCount AS Integer Declare bckColor AS String
Set recCount = 0 Set prevYear = 0
Set bckColor = "Yellow" Set bckColor = "Pink"
Set bckColor = "LgtGreen" Set bckColor = 'DrkGreen" Set
bckColor = "Beige"
Set recCount = recCount + 1
https://learn.um
uc.edu/d21/le/content/170212/viewContent/7503189 Niew
212
Create an Parallel Arrays
PreviousNext
Hide Description
Parallel Arrays
In Pseudocode, declare two 1-dimensional parallel arrays to
store the information requested in the problems below.
Use a one loop to prompt the user for the information and
assign it to the parallel arrays.
Then use a second loop to display the values of the parallel
arrays.
Put Part 1 - problem no. (1,2,3,4,5,6,7,8) in the Subject area.
Collect the following information, State and Population
You may do additional problems, if you want.
Part 2:
Convert Discussion 1 to C-code. Don't for get to prototype your
function before the main and to define your function after the
main. Put Discussion 2 - problem no.X in the Subject area and
submit a .txt (or .c) file for your code.

More Related Content

Similar to OverviewThis hands-on lab allows you to follow and experiment w.docx

Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02Suhail Akraam
 
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docxCMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docxclarebernice
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.Haard Shah
 
Control structure of c
Control structure of cControl structure of c
Control structure of cKomal Kotak
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersSheila Sinclair
 
Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxtiffanyd4
 
Python programing
Python programingPython programing
Python programinghamzagame
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptISHANAMRITSRIVASTAVA
 
Core programming in c
Core programming in cCore programming in c
Core programming in cRahul Pandit
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxamrit47
 

Similar to OverviewThis hands-on lab allows you to follow and experiment w.docx (20)

C important questions
C important questionsC important questions
C important questions
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
 
algorithm
algorithmalgorithm
algorithm
 
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docxCMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
Programming egs
Programming egs Programming egs
Programming egs
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
Pseudocode
PseudocodePseudocode
Pseudocode
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 
C++ Homework Help
C++ Homework HelpC++ Homework Help
C++ Homework Help
 
Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docx
 
Python programing
Python programingPython programing
Python programing
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.ppt
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
 
python notes.pdf
python notes.pdfpython notes.pdf
python notes.pdf
 
python 34💭.pdf
python 34💭.pdfpython 34💭.pdf
python 34💭.pdf
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 

More from gerardkortney

· Describe strategies to build rapport with inmates and offenders .docx
· Describe strategies to build rapport with inmates and offenders .docx· Describe strategies to build rapport with inmates and offenders .docx
· Describe strategies to build rapport with inmates and offenders .docxgerardkortney
 
· Debates continue regarding what constitutes an appropriate rol.docx
· Debates continue regarding what constitutes an appropriate rol.docx· Debates continue regarding what constitutes an appropriate rol.docx
· Debates continue regarding what constitutes an appropriate rol.docxgerardkortney
 
· Critical thinking paper ·  ·  · 1. A case study..docx
· Critical thinking paper ·  ·  · 1. A case study..docx· Critical thinking paper ·  ·  · 1. A case study..docx
· Critical thinking paper ·  ·  · 1. A case study..docxgerardkortney
 
· Create a Press Release for your event - refer to slide 24 in thi.docx
· Create a Press Release for your event - refer to slide 24 in thi.docx· Create a Press Release for your event - refer to slide 24 in thi.docx
· Create a Press Release for your event - refer to slide 24 in thi.docxgerardkortney
 
· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx
· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx
· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docxgerardkortney
 
· Complete the following problems from your textbook· Pages 378.docx
· Complete the following problems from your textbook· Pages 378.docx· Complete the following problems from your textbook· Pages 378.docx
· Complete the following problems from your textbook· Pages 378.docxgerardkortney
 
· Consider how different countries approach aging. As you consid.docx
· Consider how different countries approach aging. As you consid.docx· Consider how different countries approach aging. As you consid.docx
· Consider how different countries approach aging. As you consid.docxgerardkortney
 
· Clarifying some things on the Revolution I am going to say som.docx
· Clarifying some things on the Revolution I am going to say som.docx· Clarifying some things on the Revolution I am going to say som.docx
· Clarifying some things on the Revolution I am going to say som.docxgerardkortney
 
· Chapter 9 – Review the section on Establishing a Security Cultur.docx
· Chapter 9 – Review the section on Establishing a Security Cultur.docx· Chapter 9 – Review the section on Establishing a Security Cultur.docx
· Chapter 9 – Review the section on Establishing a Security Cultur.docxgerardkortney
 
· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx
· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx
· Chapter 10 The Early Elementary Grades 1-3The primary grades.docxgerardkortney
 
· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx
· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx
· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docxgerardkortney
 
· Chap 2 and 3· what barriers are there in terms of the inter.docx
· Chap 2 and  3· what barriers are there in terms of the inter.docx· Chap 2 and  3· what barriers are there in terms of the inter.docx
· Chap 2 and 3· what barriers are there in terms of the inter.docxgerardkortney
 
· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx
· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx
· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docxgerardkortney
 
· Briefly describe the technologies that are leading businesses in.docx
· Briefly describe the technologies that are leading businesses in.docx· Briefly describe the technologies that are leading businesses in.docx
· Briefly describe the technologies that are leading businesses in.docxgerardkortney
 
· Assignment List· My Personality Theory Paper (Week Four)My.docx
· Assignment List· My Personality Theory Paper (Week Four)My.docx· Assignment List· My Personality Theory Paper (Week Four)My.docx
· Assignment List· My Personality Theory Paper (Week Four)My.docxgerardkortney
 
· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx
· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx
· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docxgerardkortney
 
· Assignment 3 Creating a Compelling VisionLeaders today must be .docx
· Assignment 3 Creating a Compelling VisionLeaders today must be .docx· Assignment 3 Creating a Compelling VisionLeaders today must be .docx
· Assignment 3 Creating a Compelling VisionLeaders today must be .docxgerardkortney
 
· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx
· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx
· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docxgerardkortney
 
· Assignment 2 Leader ProfileMany argue that the single largest v.docx
· Assignment 2 Leader ProfileMany argue that the single largest v.docx· Assignment 2 Leader ProfileMany argue that the single largest v.docx
· Assignment 2 Leader ProfileMany argue that the single largest v.docxgerardkortney
 
· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx
· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx
· Assignment 1 Diversity Issues in Treating AddictionThe comple.docxgerardkortney
 

More from gerardkortney (20)

· Describe strategies to build rapport with inmates and offenders .docx
· Describe strategies to build rapport with inmates and offenders .docx· Describe strategies to build rapport with inmates and offenders .docx
· Describe strategies to build rapport with inmates and offenders .docx
 
· Debates continue regarding what constitutes an appropriate rol.docx
· Debates continue regarding what constitutes an appropriate rol.docx· Debates continue regarding what constitutes an appropriate rol.docx
· Debates continue regarding what constitutes an appropriate rol.docx
 
· Critical thinking paper ·  ·  · 1. A case study..docx
· Critical thinking paper ·  ·  · 1. A case study..docx· Critical thinking paper ·  ·  · 1. A case study..docx
· Critical thinking paper ·  ·  · 1. A case study..docx
 
· Create a Press Release for your event - refer to slide 24 in thi.docx
· Create a Press Release for your event - refer to slide 24 in thi.docx· Create a Press Release for your event - refer to slide 24 in thi.docx
· Create a Press Release for your event - refer to slide 24 in thi.docx
 
· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx
· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx
· Coronel & Morris Chapter 7, Problems 1, 2 and 3.docx
 
· Complete the following problems from your textbook· Pages 378.docx
· Complete the following problems from your textbook· Pages 378.docx· Complete the following problems from your textbook· Pages 378.docx
· Complete the following problems from your textbook· Pages 378.docx
 
· Consider how different countries approach aging. As you consid.docx
· Consider how different countries approach aging. As you consid.docx· Consider how different countries approach aging. As you consid.docx
· Consider how different countries approach aging. As you consid.docx
 
· Clarifying some things on the Revolution I am going to say som.docx
· Clarifying some things on the Revolution I am going to say som.docx· Clarifying some things on the Revolution I am going to say som.docx
· Clarifying some things on the Revolution I am going to say som.docx
 
· Chapter 9 – Review the section on Establishing a Security Cultur.docx
· Chapter 9 – Review the section on Establishing a Security Cultur.docx· Chapter 9 – Review the section on Establishing a Security Cultur.docx
· Chapter 9 – Review the section on Establishing a Security Cultur.docx
 
· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx
· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx
· Chapter 10 The Early Elementary Grades 1-3The primary grades.docx
 
· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx
· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx
· Chapter 5, Formulating the Research Design”· Section 5.2, Ch.docx
 
· Chap 2 and 3· what barriers are there in terms of the inter.docx
· Chap 2 and  3· what barriers are there in terms of the inter.docx· Chap 2 and  3· what barriers are there in terms of the inter.docx
· Chap 2 and 3· what barriers are there in terms of the inter.docx
 
· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx
· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx
· Case Study 2 Improving E-Mail Marketing ResponseDue Week 8 an.docx
 
· Briefly describe the technologies that are leading businesses in.docx
· Briefly describe the technologies that are leading businesses in.docx· Briefly describe the technologies that are leading businesses in.docx
· Briefly describe the technologies that are leading businesses in.docx
 
· Assignment List· My Personality Theory Paper (Week Four)My.docx
· Assignment List· My Personality Theory Paper (Week Four)My.docx· Assignment List· My Personality Theory Paper (Week Four)My.docx
· Assignment List· My Personality Theory Paper (Week Four)My.docx
 
· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx
· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx
· Assignment List· Week 7 - Philosophical EssayWeek 7 - Philos.docx
 
· Assignment 3 Creating a Compelling VisionLeaders today must be .docx
· Assignment 3 Creating a Compelling VisionLeaders today must be .docx· Assignment 3 Creating a Compelling VisionLeaders today must be .docx
· Assignment 3 Creating a Compelling VisionLeaders today must be .docx
 
· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx
· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx
· Assignment 4· Week 4 – Assignment Explain Theoretical Perspec.docx
 
· Assignment 2 Leader ProfileMany argue that the single largest v.docx
· Assignment 2 Leader ProfileMany argue that the single largest v.docx· Assignment 2 Leader ProfileMany argue that the single largest v.docx
· Assignment 2 Leader ProfileMany argue that the single largest v.docx
 
· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx
· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx
· Assignment 1 Diversity Issues in Treating AddictionThe comple.docx
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

OverviewThis hands-on lab allows you to follow and experiment w.docx

  • 1. Overview: This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, Analysis, , Design(program design, pseudocode), Test Plan, and implementation with C code. The example provided uses sequential, repetition statements and nested repetition statements. Program Description: This program will calculate the average of 10 positive integers. The program will ask the user to 10 integers. If any of the values entered is negative, a message will be displayed asking the user to enter a value greater than 0. The program will use a loop to input the data. Analysis: I will use sequential, selection and repetition programming statements. The program will loop for 10 positive numbers, prompting the user to enter a number. I will define three integer variables: count, value and sum. count will store how many times values greater than 0 are entered. value will store the input. Sum will store the sum of all 10 integers. I will define one double number: avg. avg will store the average of the ten positive integers input. The sum will be calculated by this formula: sum = sum + value For example, if the first value entered was 4 and second was 10: sum = sum + value = 0 + 4 sum = 4 + 10 = 14 Values and sum can be input and calculated within a repetition loop: while count <10 Input value sum = sum + value End while Avg can be calculated by: avg = value/count
  • 2. A selection statement can be used inside the loop to make sure the input value is positive. If value >= 0 then count = count + 1 sum = sum + value Else input value End If ( 7 ) Program Design: Main // This program will calculate the average of 10 integer numbers // Declare variables // Initialize variables // Loop through 10 numbers // Prompt for positive integer // Get input // test input value for gt 0 if (value > 0) //Increment counter //Accumulate sum Else // display msg to enter a positive integer // Prompt for positive integer // Get input Endif // End loop //Calculate average //Print the results (average) End Test Plan: To verify this program is working properly the input values could be used for testing:
  • 3. Test Case Input Expected Output 1 1 1 1 0 1 2 0 1 3 2 Average = 1.2 2 100 100 100 100 -100 Input a positive value 100 200 -200 200 200 Input a positive value 200 200 average is 120.0 NOTE: test #2 has 12 input numbers because there are two negative numbers. Pseudocode: Main // This program will calculate the average of 10 positive integers. // Declare variables Declare count, value, sum as Integer Declare avg as double //Initialize values
  • 4. Set count=0 Set sum = 0 Set avg = 0.0; // Loop through 10 integers While count < 10 Input value If (value >=0) sum = sum + value count=count+1 Else Pr *** Value must be positive *** Input value End if End While // Calculate average avg = sum/count // Print results End //End of Main C Code The following is the C Code that will compile in execute in the online compilers. #include <stdio.h> #include <stdbool.h> // needed for the Boolean variable debug. int main () { /* variable definition: */ int count, value, sum; float avg; bool debug; /* Initialize */ count = 0; sum = 0; avg = 0.0; debug = false;
  • 5. // Loop through to input values while (count < 10) { printf("Enter a positive Integern"); scanf("%d", &value); if (debug) printf(" value is %dn " , value ); //note the value of debug if (value >= 0) { sum = sum + value; count = count + 1; } else { printf("Value must be positiven"); } } // Calculate avg. // Since sum and count are both integers, this will give you an integer division // Hence, we need to either // Declare sum as a float or... // type cast sum as float (as shown below) avg = (float) sum/count; printf("sum is %dn", sum); printf("average is %fn " , avg ); return 0; } Setting up the code and the input parameters in ideone.com: Note the input integer values are 1, 1, 1, 0, 1, 2, 0, 1, 3, 2 for this test case. You can change these values to any valid integer values to match your test cases. You should also test with a negative number to make sure the positive integer logic works properly. Note: the input data needs to be entered into the stdin window separated by a space of new line. Results from running the programming at ideone.com:
  • 6. Learning Exercises for you to try: 1. Change the code to average 20 integers as opposed to 10. Support your experimentation with screen captures of executing the new code. What happens if you change the formatter to %.2f printf("average is %.2fn " , avg ); 2. What happens if you entered a value other than an integer? (For example a float or even a string). Support your experimentation with screen captures of executing the code. To help in your analysis try as input 1 2 3 a 4 5 Hint: activate this line if(debug) printf(" value is %dn " , value ); after the scanf statement that reads in the value. Activate by changing the value of debug. Next try as input 1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.5 What happens? 3. Modify the code to allow the user to enter an unspecified number of positive integers and calculate the average. In other words, the user could enter any number of positive integers. (Hint: You can prompt the user for how many they want to enter. Or; you could use a sentinel value to trigger when the user has completed entering values). You may need to conduct some research on your own to solve this problem. 4. Prepare a new test table with at least 3 distinct test cases listing input and expected output for the code you created. Support your experimentation with screen captures of executing the new code. Loop (Repetition) with Nested selection n statement
  • 7. v Hide Description ( 10/3/2016 ) ( Loop (Repetition) with Nested selection statement - CMIS 102 6386 Introduction to Problem Solving and
  • 8. Algorithm Design (2168) ) Whne {Cost > 0) If (Cost > 150) If (Staff > 12) Fee = 110 Else Fee = 115 Endlf NESTED LOOPS, Ifs Else Fee = 12.0, nplf EndWhi le Part 1: Create a While-End repetition structure that includes a nested if-then selection structure. Provide an overview (i.e. Program Design) of what your repetition structure is doing as well as the Pseudocode. Create a program that handles 150 passengers of an Airline with the following requirements: The first 25 passenger the ticket price is $90. The remaining passengers the ticket price is $100. The first 100 passengers get a ticket. The next 25 (i.e 101- 125) are put on standby. No more passengers are accepted after
  • 9. 125. Print out a message for each of the above categories . Part 2: Convert Discussion 1 to C-code. Don't for get to indent your code. Put Discussion 2 - problem no.X in the Subject area and submit a .txt (or .c) file for your code. 1/2 CurrDate (i.e. 2016mmdd) StartDate (i.e. 2016mmdd) // Mon start of week EndDate (i.e. 2016mmdd) // Sun end of week maxRecs 37 II the number of data records Here is what you have to work with. Don't worry about writing the data, just setting the background color. Hint: you need to compare the Date variables : CurrDate , StartDate, EndDate. What is special about the Yellow background ? To set the Beige background you need to work with prevYear and Year - Year you determine from CurrDate, prevYear you need to set in your loop appropriately. Declare CurrDate, StartDate, EndDate, Year, prevYear, maxRecs, recCount AS Integer Declare bckColor AS String Set recCount = 0 Set prevYear = 0 Set bckColor = "Yellow" Set bckColor = "Pink" Set bckColor = "LgtGreen" Set bckColor = 'DrkGreen" Set bckColor = "Beige" Set recCount = recCount + 1
  • 11. Create an Parallel Arrays PreviousNext Hide Description Parallel Arrays In Pseudocode, declare two 1-dimensional parallel arrays to store the information requested in the problems below. Use a one loop to prompt the user for the information and assign it to the parallel arrays. Then use a second loop to display the values of the parallel arrays. Put Part 1 - problem no. (1,2,3,4,5,6,7,8) in the Subject area. Collect the following information, State and Population You may do additional problems, if you want. Part 2: Convert Discussion 1 to C-code. Don't for get to prototype your function before the main and to define your function after the main. Put Discussion 2 - problem no.X in the Subject area and submit a .txt (or .c) file for your code.