首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
辅导CS‐521程序、python编程辅导、讲解python程序 讲解数据库SQL|解析Haskell程序
项目预算:
开发周期:
发布时间:
要求地区:
CS‐521 Homework Assignment 6
1
Assignment Directions
The specific instructions for these programming exercises are adapted from problems shown in the
textbook. Make sure to follow the specific instructions in THIS document.
Each program is worth 50 points for a total of 100 points (100%).
Style Requirements
For all assignments, follow the guidelines in the PEP8 Standards and Best Practices that have been
shared to date, along with course specific requirements. Minor deductions will occur for:
Improper naming of programs or zip container
o Among other things, names for regular programs and zip file must be all lower case
and class file names are CamelCase.
Missing program docstring
Inadequate # line comments (just a few in each program, don’t go crazy)
Going significantly over 80 characters for code/comment lines
Not naming objects appropriately
o variables and functions must use snake_case (lower case plus underscores)
o CONSTANT variables in all upper case
o Class Objects, which are taught in module 6, as CamelCase
Asking for input() without descriptive prompts telling the user what is expected.
o Especially not mentioning the delimiter when input will be split()
Printing output that is not clearly explained (where necessary)
Not providing a docstrings for functions and class objects
Crashing uncontrolled on bad user input
Having too large a scope for try blocks
Not using format() to round output and add thousand separating commas (US standards)
o 123456.126 should be 123,456.13 '{:,.2f}'.format(123456.126)
Having a “main()” function, with no input arguments or return values
Not using an if __name__ == '__main__' block where appropriate
CS‐521 Homework Assignment 6
2
Chapter 11 Exercise
6.11.1: Write a python program using the following requirements:
Create a class called Sentence which
has a constructor that takes a sentence string as input.
o The default value for the constructor should be an empty string
o The sentence must be a private attribute in the class
contains the following class methods:
o get_all_words — Returns all the words in the sentence as a list
o get_word — Returns only the word at a particular index in the sentence
Arguments: index
o set_word — Changes the word at a given index in sentence to a new word
Arguments: index, new_word
Does not return anything
o a str method — Returns the sentence as a string using the built‐in method
Include a unit test in an if __name__ block to test the class. Use assert to check for errors.
Hint: The problem might be easier to code if sentence attribute is a list of the words, where
punctuation has already been parsed out.
Unit Test Template:
1. Set a sentence variable with a sentence of your choice
2. Instantiate the Sentence object using the variable
3. Test that get_all_words() correctly returns that sentence as a list
4. Test that get_word(#) correctly returns the # word in the sentence
5. Test that set_word() actually changes a word in the sentence object
6. Print the sentence before and after the word change using the built in str method
CS‐521 Homework Assignment 6
3
Chapter 12 Exercise
6.12.2 Write a python program using the following requirements:
The human body has many organs. These organs have some properties in common and
others that are specialized.
Create an Organ class as a base class for specific organs
o Attributes for the organ class are:
organ_name
organ_weight_grams
is_vital_organ
organ_system
is_transplantable
organ_gender
o Required reserved methods for organ class:
Constructor
Repr method that returns the attributes of organ instance
Create a Heart class as a child of the organ class
o The heart is a vital organ in the Muscular system
o Attributes for heart, defined in the constructor, are:
heart_length_cm
heart_weight_grams (use the parent class)
heart_thickness_cm
heart_breadth_cm
o Required reserved methods for heart class:
Constructor
Repr method that returns the attributes of heart instance
o Required general methods for heart class:
heart_status – returns ‘Pumping blood’
heart_weight_oz – returns the heart weight in ounces
1 gram = 0.035 ounces
CS‐521 Homework Assignment 6
4
6.12.2 continued…
Create a Brain class as a child of the organ class
o The brain is a vital organ in the Nervous system
o Attributes for brain, defined in the constructor, are:
brain_volume (in centimeters)
brain_weight_gram (use the parent class)
o Required reserved methods for brain class:
Constructor
Repr method that returns the attributes of brain instance
o Required general methods for brain class:
brain_status – returns ‘Thinking’
brain_weight_oz – returns the brain weight in ounces
1 gram = 0.035 oz
Include a unit test in an if __name__ block to test the class. Use assert to check for errors.
Unit Test Template:
Instantiate the heart object with attributes 12, 280, 6.0, 9.0
Instantiate the brain object with attributes 1260, 1370.0
Test that all the parent and child attributes match what was instantiated
Test that the general methods return the appropriate values
Where to submit?
Click Assignments in the Navigation Area and then click on the title of the assignment to enter the
submission area and upload the zip file with your response.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!