联系方式

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

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

日期:2021-03-01 11:02

Assignment 2

Introduction to Computer Science

CSC1-UA- 0101

Sections 3 & 5

Due date for sections 3 and 5 by 2/28 by 9am EST

(Assignment is open from 2/18, 9 AM EST to 2/28 by 9 AM EST)

Code of Conduct

All assignments are graded, meaning we expect you to adhere to the academic integrity standards

of NYU. To avoid any confusion regarding this, we will briefly state what is and isn’t allowed

when working on an assignment.

Any document and program code that you submit must be fully written by yourself. You can, of

course, discuss your work with fellow students, as long as these discussions are restricted to

general solution techniques. Put differently, these discussions should not be about concrete code

you are writing, nor about specific results you wish to submit. When discussing an assignment

with others, this should never lead to you possessing the complete or partial solution of others,

regardless of whether the solution is in paper or digital form, and independent of who made the

solution. That means, you are also not allowed to possess solutions by someone from a different

year or course, by someone from another university, or code from the Internet, etc. This also

implies that there is never a valid reason to share your code with fellow students, and that there is

no valid reason to publish your code online in any form.

Every student is responsible for the work they submit. If there is any doubt during the grading

about whether a student created the assignment themselves (e.g. if the solution matches that of

others), we reserve the option to let the student explain why this is the case. In case doubts

remain, or we decide to directly escalate the issue, the suspected violations will be reported to the

academic administration according to the policies of NYU (see

https://cs.nyu.edu/home/undergrad/policy.html).

Assignment # 2 Details

Part 1 (50 points):

Weaving a Kilim Carpet Application using loops and nested loops:

Save as part1.java

Kilims are woven carpets which generally use symmetrical designs. For this assignment, instead

of using a loom, wool, and a shuttle, we are asking you to produce a pattern of your own design

using loops and nested loops.

Write a program to weave your own Kilim carpet with 30 rows by 30 columns. The patterns

should be designed by you (it should be different than the design of carpet below). Your

carpet though MUST include at least one diamond shape, checkerboards, and squares (See

example below for these patterns). Also, use other characters such as $ or % or + or @ rather

than a * to weave the rug. Make sure not to copy the entire pattern from the below rug or

copy patterns from another student! Show your creativity by weaving a different design while

meeting the requirements mentioned above. You will get extra credit for excellent design and

added features.

Here is a 12th Century Moroccan Kilim Carpet sample pattern

made of 25 rows and 36 columns:

(This design is made up of stars (asterisks) and spaces, please

ignore the border, color, and the shading effect):

Here are the requirements:

? Every print statement should print no more than one character of one '%' or one space ' '.

Do not use statements such as: print but

rather use loops for every repetition.

? Use loops and nested loops to produce these patterns.

? You can't use control structure such as switch or if/else if/else in your program.

? Your have to design your own carpet (different than the carpet from above).

? Your carpet MUST include at least one diamond shape, checkerboards, and squares. (see

example from above for these patterns).

? Some of the patterns are repeated; you might want to first isolate the elements in the

design (eg. the first two rows, the "checkerboard" elements, the triangle) and then

combine them to form the "rug".

? If the Dimond is too difficult to produce as one pattern, you can break it to 4 triangles or

apply any solution you see fit as long you comply with the assignment’s requirements.

? Extra credit if you also implement methods for part 1. Methods will be

discussed next week.

Part2 (50 points):

Number System Conversion Application using

methods and loops:

Save it as part2.java

Number system helps to represent numbers used for humans and computers. Computers, in

general, use binary numbers 0 and 1 to keep the calculations simple and to keep the amount of

necessary circuitry less, which results in the least amount of space, energy consumption and cost.

When we type any letter or word, the computer translates them into numbers (binary, base 2)

since computers can understand only numbers. A computer can understand only a few symbols

called digits and these symbols describe different values depending on the position they hold in

the number. In general, the binary number system is used in computers. However, the octal,

decimal and hexadecimal systems are also used sometimes. Numbers can be represented in any

of the number system categories like binary, decimal, hex, etc. Number conversion is extremely

important for computer scientist and therefor, you are asked to build an application to convert

between these four number systems mentioned here. I’m aware that there are many of these

programs posted on the web but you MUST produce your own as we have access to plagiarism

software that allows us to detect plagiarism from the web and from any other student work from

past years or this year. Please refer to the plagiarism policy posted on the syllabus.

The following is a diagram of converting numbers from 1 to 15 in all four number systems:

Your application allows the user to enter a number in a specific numbers system chosen by the

user and then your program converts this number to the number system that the user has chosen.

For example, here is a sample run of the program:

Enter the name of the number system to convert from: bin, or dec, or oct or hex: bin

Enter number as a String: 111

Enter the name of the number system you want to convert to: bin, or dec, or oct or hex: dec

The result is: 7

We will discuss number conversion and methods during next week but here is information

on algorithms for converting between number systems:

? Algorithm to convert from binary (base 2) to any system and from any number system to

binary https://byjus.com/maths/number-system-conversion/

? Algorithm to convert from Decimal (base 20) to any other number system and from any

number system to Decimal https://byjus.com/maths/number-system-conversion/

? Algorithm to convert from Hexadecimal (base 16) to any other number system and from

any number system to Hexadecimal: https://byjus.com/maths/hexadecimal-numbersystem/

? Algorithm to convert from Octal (base 20) to any other number system and from any

number system to Octal: https://byjus.com/maths/octal-number-system/

Requirements:

o To keep thing simple for you, use the range of numbers entered by user in your

program the same as provided by the above table allowing you to test the result

easily as all of the answers is provided by the table above. So, you can keep the

testing range from decimal numbers between 1 and 15 so you test you answer

and keep your program simple.

o You can use a String to input the number especially in the case of binary so you

don’t lose the leading zeros on the left when you input the number.

o You MUST use loops for efficiency.

o You MUST use methods to make the program more efficient. Also, look for

similar patterns of conversion algorithm between number system so you can

combine methods for efficiency if this makes sense to you.

o Please get started on the assignment immediately, and contact the class tutors as

soon as possible with any questions. Don't expect a response the day before the

due date.

o Extra credit for added features and for producing excellent and efficient

algorithm.

Grading Criteria:

Program Execution (90%)

? Meeting all of the requirements of the assignments

? No syntax, logical and runtime errors at all times

? Produces the correct output all of the time

? B. Coding Style (10%):

? Code clear and easy to read

? Proper indentation and spacing

? Good commenting style

? Good identifier names

? Clarity of code - code that’s easy to follow

C. Extra Credit (1 to 5%):

? ? For adding excellent technical features and implementing excellent and

efficient algorithms

Notes about your program:

? Style counts (that includes using meaningful names and providing sufficient comments in

the body of the programs).

? Make sure your program includes a comment at the beginning with your name, date,

along with a brief synopsis of the program/algorithm using the multiline comment \* */.

? You should use comments throughout the source code to explain key steps and

calculations

? You should use proper indentation (three spaces) and blank lines (or you can leave to the

default of the text editor default spacing) to make your program easy to read

? Capitalize the program name or class names (Prog1)

? Choose intuitive names for variables and all identifiers such as names of programs,

function or method names.

? You should use blank lines where appropriate to make your program easy to read.

? Make sure that your program does not contain any syntax errors.

? Make sure to use proper indentation after { with two spaces or whatever your editor

default spacing is.

? Make sure to only submit your .java files with no errors to NYU Classes

(https://newclasses.nyu.edu/). No need to submit the .class files.

? Late submissions will be penalized by 5% per 24 hours and it will not be accepted after

the 3 days past the due date.

? Note that your solution must work with no errors to be accepted. In case your program

does not work using java, your submission will get a zero.

? Make sure to check the lateness, extension, and plagiarism policy provided in the syllabus.

Submission

Make sure to submit the assignment by the deadline as there a penalty for each date late (see

homework Late Policy on the website) to NYU Classes under the assignment posted by midnight

in your time zone. Put all the .java files in a folder. The folder should be named with your name

and the assignment number with no spaces such as GraceHopperAsg2.zip and place all the .java

files needed for this assignment inside this folder and then zip it and submit it to NYU Classes.


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

python代写
微信客服:codinghelp