SlideShare ist ein Scribd-Unternehmen logo
1 von 2
COSC 2425 - Project 2
Part 1
Implement the following C++ code fragment in assembly
language. Use the block structured .IF and .WHILE directives.
Assume that all variables are 32-bit integers.
int array[] =
{3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4};
int lower = 4;
int upper = 9;
int ArraySize = sizeof array / sizeof lower;
int index = 0;
int sum = 0;
while( index < ArraySize )
{
if( array[index] >= lower && array[index] <= upper
)
{
sum += array[index];
}
index++;
}
Your assembly language program must also display as output
the number of times a member of 'array' qualified for inclusion
into the 'sum' and what the final value of the variable 'sum' was.
(Hint: you may have to add another variable.) Feel free to use
the author's procedures in the book's link library. Use only the
procedures that were introduced in chapter 5.
Part 2
Write an assembly language program that asks the user to enter
an integer dollar amount between 1 and 3,000. Your program
should display the corresponding class description using the
following table. Write the program so that it executes until the
user inputs some value that you determine to be the "sentinel
value". Your program must guard against and provide user
messages for input values that are outside the valid range.
Donation Amount (dollars)
Class of Donation
$2,000 and above
Platinum
$1,500 to $1,999
Gold
$1,000 to $1,499
Silver
$500 to $999
Bronze
$1 to $499
Copper

Weitere ähnliche Inhalte

Was ist angesagt?

3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arrays
allenbailey
 
Exercise6 ch2
Exercise6 ch2Exercise6 ch2
Exercise6 ch2
IIUM
 

Was ist angesagt? (18)

Code transformation by direct transformation of ASTs
Code transformation by direct transformation of ASTsCode transformation by direct transformation of ASTs
Code transformation by direct transformation of ASTs
 
Code Transformation by Direct Transformation of ASTs
Code Transformation by Direct Transformation of ASTsCode Transformation by Direct Transformation of ASTs
Code Transformation by Direct Transformation of ASTs
 
C++ by shantu
C++ by shantuC++ by shantu
C++ by shantu
 
6nullables in c#
6nullables in c#6nullables in c#
6nullables in c#
 
Concept of c
Concept of cConcept of c
Concept of c
 
Data structures Lecture no.6
Data structures Lecture no.6Data structures Lecture no.6
Data structures Lecture no.6
 
Armstrong calculator
Armstrong calculatorArmstrong calculator
Armstrong calculator
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arrays
 
Labreportofai
LabreportofaiLabreportofai
Labreportofai
 
Lo20
Lo20Lo20
Lo20
 
Write a C function that returns the length of a string. Function name: strinq...
Write a C function that returns the length of a string. Function name: strinq...Write a C function that returns the length of a string. Function name: strinq...
Write a C function that returns the length of a string. Function name: strinq...
 
Activities on Software Development
Activities on Software DevelopmentActivities on Software Development
Activities on Software Development
 
Passing stuctures to function
Passing stuctures to functionPassing stuctures to function
Passing stuctures to function
 
Analysis of algo
Analysis of algoAnalysis of algo
Analysis of algo
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
Exercise6 ch2
Exercise6 ch2Exercise6 ch2
Exercise6 ch2
 
Mettl prg
Mettl prgMettl prg
Mettl prg
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 

Ähnlich wie Cosc 2425 project 2 part 1 implement the following c++ code

C programming session 04
C programming session 04C programming session 04
C programming session 04
Dushmanta Nath
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
Vivek Singh
 
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docxCSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
faithxdunce63732
 
arrays-120712074248-phpapp01
arrays-120712074248-phpapp01arrays-120712074248-phpapp01
arrays-120712074248-phpapp01
Abdul Samee
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
dunhamadell
 

Ähnlich wie Cosc 2425 project 2 part 1 implement the following c++ code (20)

C sharp chap6
C sharp chap6C sharp chap6
C sharp chap6
 
P3
P3P3
P3
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
Arrays and strings in c++
Arrays and strings in c++Arrays and strings in c++
Arrays and strings in c++
 
C# p9
C# p9C# p9
C# p9
 
Chap 01[1]
Chap 01[1]Chap 01[1]
Chap 01[1]
 
3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.com
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.com
 
Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.com
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
Class 12 computer sample paper with answers
Class 12 computer sample paper with answersClass 12 computer sample paper with answers
Class 12 computer sample paper with answers
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docxCSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDF
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12
 
Cmis 102 Effective Communication / snaptutorial.com
Cmis 102  Effective Communication / snaptutorial.comCmis 102  Effective Communication / snaptutorial.com
Cmis 102 Effective Communication / snaptutorial.com
 
arrays-120712074248-phpapp01
arrays-120712074248-phpapp01arrays-120712074248-phpapp01
arrays-120712074248-phpapp01
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
 

Mehr von AISHA232980

Mehr von AISHA232980 (20)

Dear students,please find the below link for submitting yo
Dear students,please find the below link for submitting yoDear students,please find the below link for submitting yo
Dear students,please find the below link for submitting yo
 
Dead letters!... dead men the rhetoric of the office in me
Dead letters!... dead men the rhetoric of the office in meDead letters!... dead men the rhetoric of the office in me
Dead letters!... dead men the rhetoric of the office in me
 
Day 107 – mon february 8th name _____________________
Day 107 – mon february 8th     name   _____________________ Day 107 – mon february 8th     name   _____________________
Day 107 – mon february 8th name _____________________
 
David discussion this class taught me a number of things in rega
David discussion this class taught me a number of things in regaDavid discussion this class taught me a number of things in rega
David discussion this class taught me a number of things in rega
 
Date downloaded thu feb 11 000457 2021 source content dow
Date downloaded thu feb 11 000457 2021 source content dowDate downloaded thu feb 11 000457 2021 source content dow
Date downloaded thu feb 11 000457 2021 source content dow
 
Data presetimagefill3 27.jpgdatapresetimagefill2-26.jpg
Data presetimagefill3 27.jpgdatapresetimagefill2-26.jpgData presetimagefill3 27.jpgdatapresetimagefill2-26.jpg
Data presetimagefill3 27.jpgdatapresetimagefill2-26.jpg
 
Dataimage1 31.jpeg datapresetimagefill3-27.jpgdatapres
Dataimage1 31.jpeg datapresetimagefill3-27.jpgdatapresDataimage1 31.jpeg datapresetimagefill3-27.jpgdatapres
Dataimage1 31.jpeg datapresetimagefill3-27.jpgdatapres
 
Database activity 21. create a database called dvd.2. create
Database activity 21. create a database called dvd.2. createDatabase activity 21. create a database called dvd.2. create
Database activity 21. create a database called dvd.2. create
 
Data visualization with r rob kabacoff2018 09-032
Data visualization with r rob kabacoff2018 09-032Data visualization with r rob kabacoff2018 09-032
Data visualization with r rob kabacoff2018 09-032
 
Data visualisation23 data visualisation
Data visualisation23 data visualisationData visualisation23 data visualisation
Data visualisation23 data visualisation
 
Data visualisation sara miller mc cune founded sage
Data visualisation sara miller mc cune founded sageData visualisation sara miller mc cune founded sage
Data visualisation sara miller mc cune founded sage
 
Daily newspaper discussionshttpsmessaging custom-newsletter
Daily newspaper discussionshttpsmessaging custom-newsletterDaily newspaper discussionshttpsmessaging custom-newsletter
Daily newspaper discussionshttpsmessaging custom-newsletter
 
Cyb 690 cybersecurity program template directions the foll
Cyb 690 cybersecurity program template directions the follCyb 690 cybersecurity program template directions the foll
Cyb 690 cybersecurity program template directions the foll
 
Current anthropology volume 40, number 4, august–october 1999
Current anthropology volume 40, number 4, august–october 1999Current anthropology volume 40, number 4, august–october 1999
Current anthropology volume 40, number 4, august–october 1999
 
Cs633 formal research report or qa the final exam is due xxxx2
Cs633   formal research report or qa the final exam is due xxxx2Cs633   formal research report or qa the final exam is due xxxx2
Cs633 formal research report or qa the final exam is due xxxx2
 
Criteria ratings points content 65 to 59.0 ptsadvanced
Criteria ratings points content 65 to 59.0 ptsadvancedCriteria ratings points content 65 to 59.0 ptsadvanced
Criteria ratings points content 65 to 59.0 ptsadvanced
 
Crime is a never‐ending problem. police departments, correctiona
Crime is a never‐ending problem. police departments, correctionaCrime is a never‐ending problem. police departments, correctiona
Crime is a never‐ending problem. police departments, correctiona
 
Creating your personal budget for this assignment, you will apply
Creating your personal budget for this assignment, you will applyCreating your personal budget for this assignment, you will apply
Creating your personal budget for this assignment, you will apply
 
Creating a culture of innovation and creativity overview
Creating a culture of innovation and creativity overviewCreating a culture of innovation and creativity overview
Creating a culture of innovation and creativity overview
 
Create an annotated bibliography assignment using your research q
Create an annotated bibliography assignment using your research qCreate an annotated bibliography assignment using your research q
Create an annotated bibliography assignment using your research q
 

Kürzlich hochgeladen

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Kürzlich hochgeladen (20)

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

Cosc 2425 project 2 part 1 implement the following c++ code

  • 1. COSC 2425 - Project 2 Part 1 Implement the following C++ code fragment in assembly language. Use the block structured .IF and .WHILE directives. Assume that all variables are 32-bit integers. int array[] = {3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4}; int lower = 4; int upper = 9; int ArraySize = sizeof array / sizeof lower; int index = 0; int sum = 0; while( index < ArraySize ) { if( array[index] >= lower && array[index] <= upper ) { sum += array[index]; } index++; } Your assembly language program must also display as output the number of times a member of 'array' qualified for inclusion into the 'sum' and what the final value of the variable 'sum' was. (Hint: you may have to add another variable.) Feel free to use the author's procedures in the book's link library. Use only the procedures that were introduced in chapter 5. Part 2 Write an assembly language program that asks the user to enter an integer dollar amount between 1 and 3,000. Your program should display the corresponding class description using the following table. Write the program so that it executes until the
  • 2. user inputs some value that you determine to be the "sentinel value". Your program must guard against and provide user messages for input values that are outside the valid range. Donation Amount (dollars) Class of Donation $2,000 and above Platinum $1,500 to $1,999 Gold $1,000 to $1,499 Silver $500 to $999 Bronze $1 to $499 Copper