首页
编程语言
数据库
网络开发
Algorithm算法
移动开发
系统相关
金融统计
人工智能
其他
首页
>
> 详细
辅导159.171留学生、辅导Python、Python编程设计调试、programs留学生讲解 讲解SPSS|辅导留学生 Statisti
159.171 - Assignment 3 – 2019
Worth: 20% of final mark
Due date: 6pm Friday, May 31st
For all two programs:
use meaningful names for variables and functions.
add any comments you think will help explain what your program's doing
Question 1: Random Real Estate Advertisement Generator (10 marks)
Write a program that reads in a file of properties and produces random but realistic advertisements,
according to the rules specified on the next page.
Here are two examples:
*** Your Brand New Home ***
Spacious 2 bedroom home in Hokowhitu.
Would suit a retired couple.
Close to hospital.
Price $320,000.
All enquires to John on 021-027-1234.
*** Make it yours today! ***
*** Your New Family Home ***
Wonderful 3 bedroom home in Terrace.
Would suit a professional couple.
Close to motorway.
Price Auction.
All enquires to Joe on 183-007-1239.
*** Make it yours today! ***
It does this by randomly choosing properties that meet certain criteria.
The basic structure of your advertisement is below, where parts in <...> are words/phrases to
be randomly selected from the lists:
*** Your
Home ***
bedroom home in
.
Would suit
.
Close to
.
Price
.
All enquires to
on
.
*** Make it yours today! ***
Randomly choose an item from the following lists to fill in the description, adjective, and type of
owner, but the word selected for description must meet the rules specified on the next page.
description = ['First', 'Dream', 'New Family', 'Brand New']
adjective = ['Wonderful', 'Sunny', 'Spacious', 'Secluded']
type_of_owner = ['a couple', 'a family', 'a retired couple',
‘a large family', 'a professional couple'] 159.171 Assignment 3 Page 2 of 6
Randomly choose a property from properties.txt (download it on Stream) to fill in the number
of bedrooms, suburb, amenities close by, price, agent name and agent phone based on the
selected type of owner and the rules specified in the below table.
In properties.txt, each line is the detailed information of a property: each part is separated by a
hyphen (“-”); nearby amenities are connected by a colon (“:”). The following is an example of a
property:
no of bathrooms
Albany-3-2-$670000-great schools:bus station:shopping centre-John-0234513456
suburb price amenities close by agent name agent phone
no of bedrooms
The detailed information of this property is:
suburb: Albany
no of bedrooms: 3
no of bathrooms: 2
price: $670,000
amenities close by: great schools, bus station, shopping centre
agent name: John
agent phone: 023-451-3456
According to the rules specified in the above table, this property is suitable for a family owner or
a professional couple owner. For other types of owner (a couple, a retired couple, and a big
family), this property is unable to meet their criteria.159.171 Assignment 3 Page 3 of 6
Commands
Make the following commands available using a menu and prompt for a command. The commands
can be upper or lower case (e.g. e or E) or either. It'll be easier if you implement the commands in
order (L first ...)
CMD Effect
L Load properties.txt from disk to form a property list.
T Test: display the first two properties from the property list to make sure they've
been loaded.
E
Easy advertisement: display an advertisement -- a randomly selected property
from the property list and randomly selected words from description, adjective
and type_of_owner lists.
R
Real advertisement: generate & display a real estate advertisement conforming
to the rules specified on the previous page. If the wordlists haven't been loaded,
display an error message.
S
Search: Prompt for a type of owner, and then search for all properties that meet
this type of owner’s criteria specified on the previous page. Next sort these
properties by price. Finally produce & display three advertisements: one is for a
property with the lowest price; second is for a property with the highest price;
third is for a property by Auction. Search case-independently. If the search string
is empty, exit the search and redisplay the menu.
Q Quit the program.
For full marks
The sentences in the advertisement should be capitalised correctly and have a trailing full
stop.
Words for description, suburb, and name should be capitalised.
Price has two types of value: one is amount, another is Auction. The format for price is
$11,111,111 or Auction.
The formats for phone should be 11-111-1111. 159.171 Assignment 3 Page 4 of 6
Question 2: Student Profiles (10 marks)
Using a dictionary indexed by student ID, write a simple Student Profiles that lets you save
these profile details.
Here student ID is composed of 7 digital numbers and always starts with 192. It should be
generated automatically. Each student’s ID should be unique.
The usercode is composed of the first letter of the student’s first name and the student’s last
name, if there are duplicates, append a number to distinguish them. Each student’s usercode is
unique. For example,
Student Name Usercode
Xing Chen xchen
Alan Wang awang
Xiaoping Chen xchen1
John Truter jtruter
Xiaoai Chen xchen2
When adding Xiaoping Chen to the Student Profiles, xchen already exists, so this
student’s usercode becomes xchen1.
While Xiaoai Chen is added, there already have two xchen in the Profiles, so xchen2 is
this student’s usercode.
Once the name of a student is known, the program should automatically generate this
student’s usercode.
Each dictionary entry contains a dictionary of the details of that student, so
students['1920001'] # will return the dictionary that contains details of
a student whose ID is 1920001,
and
profiles = students['1920001']
address = profiles['address']
or simply
address = profiles['1920001']['address']
will return the address of the student whose ID is 1920001.159.171 Assignment 3 Page 5 of 6
The program first displays a menu (something like that shown below) and carries out the
appropriate action depending on which letter the user types, and then redisplays the menu:
find prompt for a usercode or student ID, then search for the name, address, email
and phone number of the student with this usercode or ID in Student Profiles
and display their details. Make the search is case-insensitive.
add prompt separately for each of name, address, email, and phone-no. Then
automatically generate this student’s ID and usercode and save all of these
fields into a data structure. A dictionary is recommended but a list will also
work.
delete prompt for a usercode or student ID, then find and display the related entry.
Ask the user if this is the correct one to be deleted. If they reply "yes", delete
it.
modify prompt for a usercode or student ID, then prompt for a field, e.g. name,
address, email, or phone-no. Next prompt for a new value for the field.
Display the student’s detail. Ask the user if this is the correct student and is
the right field to be modified. If they reply "yes", replace this field with the
new value.
list all As expected list all the entries, numbered sequentially. Display all the fields
and format them for easy reading. Down and cross layouts are shown below.
Down
ID Name Usercode Address Email Phone
1 1920001 Sue Chen schen 104 Broad Way schen@massey.co.nz 021-334-2312
2 1920002 Robert Lee rlee 25 Ritzherbert Ave rlee@massey.co.nz 021-489-8865
The Student Profiles - Getting Started:
get the menu going and then create a function for each of list-all, add, ... Initially, simply
put a print inside each function, e.g. for the addEntry function, put print("You called
ADD"). You can test each command – they'll simply print out a message.
using an assignment statement, manually create a tiny Student Profiles containing two or
three entries
get the list-all command going. You can use this to view your manually created Student
Profiles and effects of the later commands
then work on add, find, delete and modify
to abort the add command (and find/delete/modify), simply enter an empty string.
IMPORTANT:
make sure that there are no duplicates for Student IDs and Usercodes,
make sure that you use functions, usually one for each of the commands. You can of
course, create any additional functions that you think will help to simplify or clarify your
code.
Optional (you can get full marks without doing this): you could try adding a s (search)
command that searches for and displays all entries that have the search string in any of the fields
(not just the ID or usercode).
What and how to submit
How: ALL submissions must be via Stream (not email) using the Assignment 2 submission link.
What: Submit your Python programs, each named with .py extensions. You should have three .py
files to submit, one for each question.
Do not submit Word documents (.doc or .docx) or .zip or .rar files.
Check:
that your files have a .py extension
that all programs display your name and your Massey Student ID number when starting.
联系我们
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-21:00
微信:codinghelp
热点文章
更多
辅导 comm2000 creating socia...
2026-01-08
讲解 isen1000 – introductio...
2026-01-08
讲解 cme213 radix sort讲解 c...
2026-01-08
辅导 csc370 database讲解 迭代
2026-01-08
讲解 ca2401 a list of colleg...
2026-01-08
讲解 nfe2140 midi scale play...
2026-01-08
讲解 ca2401 the universal li...
2026-01-08
辅导 engg7302 advanced compu...
2026-01-08
辅导 comp331/557 – class te...
2026-01-08
讲解 soft2412 comp9412 exam辅...
2026-01-08
讲解 scenario # 1 honesty讲解...
2026-01-08
讲解 002499 accounting infor...
2026-01-08
讲解 comp9313 2021t3 project...
2026-01-08
讲解 stat1201 analysis of sc...
2026-01-08
辅导 stat5611: statistical m...
2026-01-08
辅导 mth2010-mth2015 - multi...
2026-01-08
辅导 eeet2387 switched mode ...
2026-01-08
讲解 an online payment servi...
2026-01-08
讲解 textfilter辅导 r语言
2026-01-08
讲解 rutgers ece 434 linux o...
2026-01-08
热点标签
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: 99515681 微信:codinghelp
© 2024
www.7daixie.com
站长地图
程序辅导网!