首页 > > 详细

java国外辅导、java数据分析辅导讲解留学生java|辅导java程序、讲解java 解析Haskell程序|解析Haskell程序

TCSE1PE – Trimester 2 2018
La Trobe Melbourne
Foundation Studies and Diploma Programs
Course: Diploma of Information Technology
Subject Code: TCSE1PE
Subject Name: Programming Environment
Submission
Instructions: See page 4
I declare that the work I am submitting is my own work, and acknowledgement has been made
when citing the words or ideas of others. I have read the Academic Integrity policy and understand
that academic misconduct can incur disciplinary measures such as reduction of marks or zero marks
awarded. Producing assignments in collaboration when the assignment is an individual piece is also
subject to disciplinary action.
Name:
Student ID:
TCSE1PE – Trimester 2 2018
2
Guess the number
Design and implement a Java application to address the following problem description. Your
implementation should be strictly based on your own design and creativity will be
rewarded.
Problem Description
Learning about your outstanding programming skills, the principal of your local primary
school wants you to develop a fun number game for his students.
Student will first input their name and age. The program should then generate a random
number within the following range based on student’s age:
Age (years) Range (inclusive)
4-7 1-25
8-12 1-25
12+ 1-30
For example, if a student is aged 9, the program should generate a random number
between 1 and 15 (inclusive). Hint: You can use the inbuilt Math.random() method to generate a
random number in Java.
Students below 4 years of age are strictly not allowed to continue due to their notorious
history of smudging water colours on the school’s only laptop! The program should exit with
an appropriately stern warning.
Each student should get 10 attempts per game to guess the number. In case of a wrong
attempt, the program should display ‘GO HIGHER!’ if student’s guess is lower than the
number generated or ‘GO LOWER!’ if it is greater. If student makes a correct guess, the
program should score student for the game based on number of attempts required to make
the correct guess.
TCSE1PE – Trimester 2 2018
3
Number of attempts Score (out of 5)
1-3 5
4-6 3
7-10 1
No score is awarded if the student is unable to make a correct guess within the allowed 10
attempts.
After each game, student can either continue playing the game or choose to exit the
program. When the student finally chooses to exit, the program should display the following
overall statistics:
1. Total number of games played
2. Number of games where correct guess was made
3. Overall score of the user in following format -
“Hello Patrick, you scored 12 out of possible 15.”
Bonus Task (10 marks):
Modify your program so that the random number generated is always a prime number.
Hint: A prime number is a number that is divisible only by itself and 1 (e.g. 2, 3, 5, 7, 11).
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!