联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2021-02-22 09:55

Project 4 - Nested Loops and Procedures

Due Sunday by 11:59pm Points 50 Submitting a file upload File Types asm

Available after Feb 7 at 12am

Submit Assignment

Introduction

The purpose of this assignment is to reinforce concepts around procedures, nested loops,

and data validation (CLO 3, 4). Please be sure to thoroughly check the rubric - there are

some specific requirements with point penalties if they are not satisfied.

1. Designing and implementing procedures

2. Designing and implementing loops

3. Writing nested loops

4. Understanding data validation

What you must do

Program Description

Write a program to calculate prime numbers. First, the user is instructed to enter the number of primes

to be displayed, and is prompted to enter an integer in the range [1 ... 200]. The user enters a number,

n, and the program verifies that 1 ≤ n ≤ 200. If n is out of range, the user is re-prompted until they

enter a value in the specified range. The program then calculates and displays the all of the prime

numbers up to and including the n prime. The results must be displayed 10 prime numbers per line,

in ascending order, with at least 3 spaces between the numbers. The final row may contain fewer than

10 values.

Program Requirements

1. The programmer’s name and program title must appear in the output.

2. The counting loop (1 to n) must be implemented using the LOOP instruction.

3. The main procedure must consist of only procedure calls (with any necessary framing). It should

be a readable "list" of what the program will do.

4. Each procedure will implement a section of the program logic, i.e., each procedure will specify how

the logic of its section is implemented. The program must be modularized into at least the following

procedures and sub-procedures:

getUserData

validate

showPrimes

isPrime

farewell

The upper and lower bounds of user input must be defined as constants.

If the user enters a number outside the range [1 ... 200] an error message must be displayed and

the user must be prompted to re-enter the number of primes to be shown.

The program must be fully documented and laid out according to the CS271 Style Guide. This

includes a complete header block for identification, description, etc., a comment outline to explain

each section of code, and proper procedure headers/documentation.

Notes

1. For this program, you may use global variables instead of passing parameters in memory or on the

stack. This is a one-time relaxation of the standards so that you can get accustomed to using

procedures.

2. A number k is prime if it is an integer with exactly 2 distinct divisors: 1 and k. Note that this implies

that

a. 1 is not prime.

b. k must be positive.

3. There are several ways to make your isPrime procedure efficient. Feel free to discuss algorithms

on Piazza and Slack.

4. Check the Course Syllabus for late submission guidelines.

5. Find the assembly language instruction syntax and help in the CS271 Instructions Guide.

6. To create, assemble, run, and modify your program, follow the instructions on the course Syllabus

Page’s "Tools" tab.

Resources

Additional resources for this assignment

Project Shell with Template.asm

CS271 Style Guide

CS271 Instructions Reference

CS271 Irvine Procedure Reference

What to turn in

Turn in a single .asm file (the actual Assembly Language Program file, not the Visual Studio solution

file). File must be named "Proj4_ONID.asm" where ONID is your ONID username. Failure to name

files according to this convention may result in reduced scores (or ungraded work). When you

resubmit a file in Canvas, Canvas can attach a suffix to the file, e.g., the file name may become

2/19/2021 Project 4 - Nested Loops and Procedures

https://canvas.oregonstate.edu/courses/1798799/assignments/8201478 3/8

Proj4_ONID-1.asm. Don't worry about this name change as no points will be deducted because of

this.

Example Execution

User input in this example is shown in boldface italics.

Prime Numbers Programmed by Euclid

Enter the number of prime numbers you would like to see.

I’ll accept orders for up to 200 primes.

Enter the number of primes to display [1 ... 200]: 301

No primes for you! Number out of range. Try again.

Enter the number of primes to display [1 ... 200]: 0

No primes for you! Number out of range. Try again.

Enter the number of primes to display [1 ... 200]: 31

2 3 5 7 11 13 17 19 23 29

31 37 41 43 47 53 59 61 67 71

73 79 83 89 97 101 103 107 109 113

127

Results certified by Euclid. Goodbye.

Extra Credit (Original Project Definition must be Fulfilled)

To receive points for any extra credit options, you must add one print statement to your program

output per extra credit which describes the extra credit you chose to work on. You will not receive

extra credit points unless you do this. The statement must be formatted as follows...

--Program Intro--

**EC: DESCRIPTION

--Program prompts, etc—

Extra Credit Options

1. Align the output columns (the first digit of each number on a row should match with the row above).

(1pt)

2. Extend the range of primes to display up to 4000 primes, shown 20 rows of primes per page. The

user can “Press any key to continue …” to view the next page. Since length of the numbers will

increase, it’s OK to display fewer numbers per line. (2pt)

Grading criteria

2/19/2021 Project 4 - Nested Loops and Procedures

https://canvas.oregonstate.edu/courses/1798799/assignments/8201478 4/8

Project 4 Rubric

Please view the rubric attached to this assignment to understand how your assignment will be graded.

If you have any questions please ask on the course discussion board.

Criteria Ratings Pts

Files Correctly Submitted

Submitted file is correct assignment and is an

individual .asm file.

1 pts

Full Marks

0 pts

No Marks

Program Assembles & Links

Submitted program assembles and links without

need for clarifying work for TA and/or messages

to the student. This assumes the program is

actually an attempt at the assignment. Nonattempts

which compile/link earn no points.

1 pts

Full Marks

0 pts

No Marks

Documentation - Identification Block - Header

Name, Date, Program number, etc as per Style

Guide are included in Identification Block

1 pts

Full Marks

0 pts

No Marks

Documentation - Identification Block - Program

Description

Description of functionality and purpose of

program in student's own words is included in

identification block.

1 pts

Full Marks

0 pts

No Marks

Documentation - Procedure Headers

Procedure headers as per Style Guide: Describe

functionality and implementation of program flow;

list pre- and post-conditions and registers

changed; ...

4 pts

Full

Marks

2 pts

Headers without Conditions

Descriptive headers but lacking

pre- and post-conditions and

'registers changed'

0 pts

No

Marks

Documentation - Section and In-line Comments

Section and In-line comments contribute to

understanding of program flow where necessary,

but are not line-by-line descriptions of moving

memory to registers. See CS271 Style Guide.

Verification - Program Executes

Program executes and makes some attempt at

the assigned functionality.

3 pts

Full

Marks

2 pts

Failed

Attempt

Program is

an attempt at

the correct

assignment

but simply

does not run.

0 pts

Not An Attempt

Program executes but is

either the incorrect

program or some quickly

mashed together

nonsense, submitted only

to 'get a few points'

Completeness - Displays Title & Programmer

Name

Program prints out the programmer's name and

Program Title

1 pts

Full Marks

0 pts

No Marks

Completeness - Prompts for Input (with Bounds)

Prompts user to enter data, specifying bounds of

acceptable inputs.

1 pts

Full Marks

0 pts

No Marks

Completeness - Gets data from User

Utilizes ReadInt or ReadDec to receive user

input. Saves values in appropriately-named

identifiers for validation.

1 pts

Full Marks

0 pts

No Marks

Completeness - Validates User Data

Validates that user-entered values are within the

advertised limits.

2 pts

Full

Marks

1 pts

Partial validation

Neglects to check edge cases,

otherwise functional.

0 pts

No

Marks

Completeness - Displays Results 2 pts

Full Marks

0 pts

No Marks

Completeness - Displays closing message 1 pts

Full Marks

0 pts

Correctness - Displays correct number of prime

numbers

4 pts

Full

Marks

3 pts

Mostly Correct

Edge cases are neglected or

display incorrectly.

0 pts

No

Marks

Correctness - Calculations are Correct

All displayed values are in-order primes,

beginning with the number '2'

6 pts

Full

Marks

2 pts

Not Perfect

Some (fewer than 5) non-prime

values appear, or some primes

(fewer than 5) appear out of order

0 pts

No

Marks

Correctness - Numbers are displays 10 per line

May be a different value if student implemented

Extra Credit option 2. Should still be consistent.

3 pts

Full Marks

0 pts

No Marks

Correctness - Partial lines displayed correctly 1 pts

Full Marks

0 pts

No Marks

Requirements - Limits are CONSTANTs

Min/Max number of primes are defined and used

as CONSTANTs.

2 pts

Full Marks

0 pts

No Marks

Requirements - Program is well-modularized

Program is divided into logical sections based on

function. Program implements all required

procedures with good logical flow according to

class lectures.

10 pts

Full

Marks

8 pts

Lacking some

Procedures

Well

modularized,

but lacking all

required

procedures

1 pts

No

procedures

Well

modularized,

but fails to

utilize

procedures

0 pts

No

Marks

Requirements - Counted loop uses LOOP

instruction

(-10 points if counted loop does not use LOOP

instruction)

0 pts

Full Marks

0 pts

No Marks

2/19/2021 Project 4 - Nested Loops and Procedures

https://canvas.oregonstate.edu/courses/1798799/assignments/8201478 8/8

Total Points: 50

Criteria Ratings Pts

1 pts

1 pts

1 pts

0 pts

0 pts

0 pts

Coding Style - Uses appropriately named

identifiers

Identifiers named so that a person reading the

code can intuit the purpose of a variable,

constant, or label just by reading its name.

(CS271 Style Guide)

1 pts

Full Marks

0 pts

No Marks

Coding Style - Readability

Program uses readable white-space, indentation,

and spacing as per the CS271 Style Guide.

Logical sections are separated by white space.

1 pts

Full Marks

0 pts

No Marks

Output Style - Readability

Program output is easy to read

1 pts

Full Marks

0 pts

No Marks

Extra Credit

Output columns aligned (+1) |

4000 primes with paged output (+2)

0 pts

Full Marks

0 pts

No Marks

Late Penalty

Remove points here for late assignments. (Enter

negative point value)

0 pts

Full Marks

0 pts

No Marks

Pre-filled Primes Penalty

If student utilizes an array, list, file etc.. pre-filled

with primes (more than 2 primes), deduct 20

points here.

0 pts

Full Marks

0 pts

No Marks


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp