首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
讲解JAVA编程、program程序辅导 讲解R语言编程|讲解SPSS
项目预算:
开发周期:
发布时间:
要求地区:
Object Oriented Programming 1 - JAVA PROG10082
Assignment 3 1
Assignment 3 Selections
Description
This lab is based on the material studied in week 4 and 7, including the exercises done in class.
This assignment is to be done individually; you are not allowed to work on this assignment with anyone.
See also the Academic Integrity Policy and the Assignment and Exam Policies
Question 1
An underground parking garage requires a program that allows clerks to calculate and display a bill for customer
parking charges. A customer is charged when they leave the garage, and the amount charged is based on a few
different factors. Some customers own a special membership card if they work in the building above the garage,
so they are charged a special hourly rate of only $2 per hour. Customers without the card are charged $3 per
hour, unless they park for more than 12 hours, in which case they are charged only $2.50 per hour. Partial hours
are rounded up to the next hour, so if a customer parks for 5.2 hours, the charge is calculated for 6 hours. HINT:
chargeable hours = Math.ceil(actual hours). The maximum charge allowed is $100, so if a customer's total
charges are more than $100, they will be charged exactly $100.
To retrieve the input for the membership card, you have a few choices. For example, you could assign numeric
values for member and non-members and have the user enter an integer:
Membership Status (1 = member, 0 = non-member):
Then you simply need to check the user-entered value to see if the customer is a member or not.
You could also do this with Strings/characters, for example:
Is customer a member (Y/N)?
This would require a bit more advanced coding to grab a single character from the user and check that it's 'Y' for
member. (Hint: check in-class exercise coding solutions)
Sample program interaction (prompts in black, user input in blue) with output at the end in green. These colours
are here for demonstration only; your program does not need to display in colour):
Enter time parked: 5.5
Membership Status (1 = member, 0 = non-member): 1
Hourly Rate: $ 2.00
Chargeable Hours: 6.00
Total Charges: $ 12.00
Note the formatting above: All values are formatted to 2 decimal places and numbers are aligned right-justified
at the decimal point. Your output must appear in the exact same format as shown above.
Object Oriented Programming 1 - JAVA PROG10082
Assignment 3 2
All literal numeric values in your program must be defined as constants. Be sure to use well-defined and
appropriate names for all of your constants and variables.
Here is an IPO chart to help you understand the program's requirements:
Inputs: - number of hours parked
- whether or not the customer has a membership card
Processing: - determine hourly rate based on membership status and hours parked
- chargeable hours = ceiling of actual hours parked
- total charges = hourly rate * chargeable hours
Outputs: - hourly rate
- chargeable hours
- total charges
Don't forget to include proper documentation describing your code statements!
Question 2
Write a program that plays a random number guessing game. Generate a random number between 1 and 100
(Math.random() * 100 + 1) and repeatedly ask the user to guess what the number is. Display messages to help
the user: if the number they guessed is lower than the correct number, or if the number they guessed is higher
than the correct number, say so. Eventually, the user will guess the correct number. Once this happens, ask the
user if they'd like to play the game again. If they say yes, do the whole game again. If they say no, display a
"Thanks for playing" message. Allow the user to give up at any time by ending a negative number for their guess
(display the actual number after the user gives up).
Numbers must all be integers. "Play again?" input must be character (char) type.
Sample program interaction (prompts in black, user input in blue) with output at the end in green. These colours
are here for demonstration only; your program does not need to display in colour):
I'm thinking of a number between 1 and 100. What is it?
Guess: 50 Too high. Guess: 25 Too high.
Guess: 15 Too low.
Guess: 20
Too low. Guess: 23
You got it!
Play again? (Y/N) Y
I'm thinking of a number between 1 and 100.
What is it?
Object Oriented Programming 1 - JAVA PROG10082
Assignment 3 3
Guess: 50 Too low.
Guess: 75
Too high. Guess: 65
Too high.
Guess: 55 Too low. Guess: 60
Too high. Guess: 57 Too low.
Guess: 58 Too low. Guess: 59
You got it!
Play again? (Y/N)
n
Thanks for playing!
[TIPS]: It's easier to tackle this problem in stages.
• First, get one game running
• Next, get more than one game running
• At last, add more option, i.e. allow user to give up by input a negative number
Step 1: I'm thinking of a number between 1 and 100. What is it?
Guess: 50
Too high! Guess: 25 Too low!
Guess: 35 Too low! Guess: 40
Too high! Guess: 37 Too low!
Guess: 38 Too low!
Guess: 39
You got it!
Thanks for playing! Step 2: I'm thinking of a number between 1 and 100.
What is it? Guess: 50 Too high.
Guess: 25
Too high. Guess: 15
Too low.
Guess: 20 Too low.
Object Oriented Programming 1 - JAVA PROG10082
Assignment 3 4
Guess: 23 You got it!
Play again? (Y/N) y
I'm thinking of a number between 1 and 100. What is it? Guess: 50
Too low. Guess: 75 Too high.
Guess: 65 Too high. Guess: 55
Too low. Guess: 60
Too high.
Guess: 57 Too low.
Guess: 58
Too low. Guess: 59
You got it!
Play again? (Y/N)
n
Thanks for playing!
Step 3: I'm thinking of a number between 1 and 100. What is it?
Guess: 50
Too high. Guess: 25 Too low. Guess: 35 Too low. Guess: 45 Too high. Guess: 40 Too low.
Guess: -1 You gave up!
Your number was 42.
Submission
All submissions are expected to abide by the Submission Standards and all code is expected to abide by the
Coding Standards for this Course. Before the deadline specified on Slate.
You are to submit 3 files for each questions:
1. Your Java source code for your program.
2. A text or word processed document containing all of your source code.
3. Screenshot a screenshot of your code & console display (.jpg file)
Object Oriented Programming 1 - JAVA PROG10082
Assignment 3 5
1. Source Code File:
• Submit only the source code file (.java) for your program. DO NOT submit anything else or you will
lose marks. DO NOT submit .class files, DO NOT submit your editor's backup files (e.g. .java~
or .bak), etc.
• DO NOT compress your files by using ZIP or RAR
• The name of your file should be YourfirstnameYourlastnameAssignment#Q#.java, For example,
JohnSmithAssignment1Q1.java.
2. Document of Source:
You must also copy and paste all of your source code into a plain text file (e.g. .TXT), or Word document
(e.g. .DOC/.DOCX). Submit this document in addition to your source code java file. This is used for SLATE's
originality checker.
Submit your assignment to where you download this instruction in SLATE, that is
Slate/Assessment/Assignment/Assignment 3, click [add a file].
IMPORTANT: Failure to follow any of the instructions above will result in penalties or a grade of 0.
Evaluation
Your submission will be evaluated based on the following criteria:
• Efficient Code: Program uses variables where and only when necessary; program doesn't define
variables that are never used, nor does it use too many variables for unnecessary tasks; program logic is
written concisely and is not cluttered with unnecessary tasks.
• Functionality: program functions according to specifications - input and output is done on the console
using the techniques discussed in class; variables are used to store user inputs until they are needed for
output.
• Programming Style: proper indentation and spacing, use of comments/documentation; all identifiers are
descriptive and valid; variables are defined with appropriate types and converted when required.
• Other: all instructions regarding submissions and program specifications have been followed;
submission was completed and submitted as requested in a timely fashion; techniques discussed in class
have been used.
Copyright:
This work is the intellectual property of Wendi Jollymore & Yan Cui. Any further copying and
distribution outside of class must be within the copyright law. Posting to commercial sites for profit is
prohibited.
© Wendi Jollymore & Yan Cui, et al
软件开发、广告设计客服
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
软件定制开发网!