CON3602 Programming Fundamentals for Geomatics EA Project (50%)
Assignment Due Date: 14 Dec 2023, Thursday, 23:59
Instructions to Students
1. This project should be done by each individual student.
2. Plagiarism will be treated seriously. All assignments that have been found involved wholly or partly in
plagiarism (no matter these assignments are from the original authors or from the plagiarists) will score Zero marks. You will be asked a random question on your program to verify that your submission is your own work.
3. Your program must be structured and well documented. The first few lines in the source file must be a comment stating the name of the source file, and the name, course, class, student number as well as the main methods of the program. Marks will be deducted if such comments are not included.
4. You are required to hand in the following:
a. Program codes .java file(s) (soft copy)
5. The filenames for the Basic Stage and Advanced Stage should be MathBasic.java and MathAdvanced.java respectively. You need to hand in the two files separately if you do the Advanced Stage.
6. Submit all files to Moodle as instructed by your teacher, Late submission is NOT accepted.
7. No re-submission to Moodle is allowed. Please test your program thoroughly before each submission.
Project Path and Milestones
16 Stage 4: Present Products Publicly in the form of program
documentation
Document the codes properly with comments explaining the logic and methods used.
Program codes .java file(s)
Project Path for PBL
Week No.
Stage No.
Learning Activities
Submission
13
Stage 1: Launch Project
Review the objectives and plan the project by creating an outline of the tasks to be completed.
-
14
Stage 2: Build Knowledge
Familiarize integer operations such as Remainder, GCD, and LCM, and how they can be implemented in Java.
15
Stage 3: Develop and Critique
Begin coding by implementing the main menu and handling user inputs as per project requirements.
Develop critical thinking by testing the program thoroughly to ensure all parts are working correctly.
Page 1
CON3602 Programming Fundamentals for Geomatics EA Project (50%)
MATH QUIZ
Basic Stage (75%) (MathBasic.java)
Problem Specification
You are asked to design and develop a Java Program that randomly generates mathematics questions and computes the percentage of correct answers. The program is divided into 5 steps (not necessarily sequential).
Step 1: Main Menu
When the program starts, Main Menu will be shown as follows:
Figure 1. Basic Stage Main Menu
Welcome to IP Math Quiz
*** Main Menu ***
1) Remainder
2) Greatest Common Divisor (GCD)
3) Least Common Multiple (LCM)
9) Quit
>_
Page 2
CON3602 Programming Fundamentals for Geomatics EA Project (50%)
You have to handle the following user input:
Questions generated in Step 3 will be Remainder questions. Proceeds to Step 2
Questions generated in Step 3 will be Greatest Common Divisor (GCD)
User Input
Action
1
2
questions.
Proceeds to Step 2
Questions generated in Step 3 will be Least Common Multiple (LCM)
3
Proceeds to Step 2
questions. Proceeds to Step 5
9
Step 2: Specify the number of questions
After selecting the type of question successfully in Step 1, we specify the number of questions as follows:
Number of Questions: _
Figure 3. Number of Questions
For example, if the user input is 10, then 10 questions of the chosen type (remainder, GCD, LCM) will be asked in Step 3.
Step 3: Generate Random Questions
n questions will be generated, where n is specified in Step 2. The questions type is based on the input in Step 1. For example: If we input 3 in Step 1 (i.e. Least Common Multiple (LCM)) and input 10 in Step 2, then Step 3 will ask 10 Least Common Multiple (LCM) questions.
Note that all questions should have the question number. For example, Q1 for first question and Q10 for the tenth question.
Q1:20%3 =_
Q1: 20 % 3 = 2 Q2: 44 % 8 = 4 ...
...
Q10: 36 % 7 = _
Figure 4. Example of Remainder questions
Page 3
CON3602 Programming Fundamentals for Geomatics EA Project (50%)
Q1: GCD (54,24) = 6 Q2: GCD (24,36) = 12 ...
...
Q10: GCD (33,27) = _
Figure 5. Example of Greatest Common Divisor (GCD) questions
Figure 6. Example of Least Common Multiple (LCM) questions Operands generated in different operations should obey the following rules:
Q1: LCM (72,84) = 504 Q2: LCM (55,63) = 3465 ...
...
Q10: LCM (62,91) = _
Operator
Operands
Remainder
First operand should be between 20 and 50.
Second operand should be between 1 and 10.
Greatest Common Divisor (GCD) Least Common Multiple (LCM)
Step 4: Result
Two operands should be between 1 and 100.
Results should be > 1
Two operands should be between 55 and 150.
The correctness of every answer in Step 3 is checked. The result will be shown as follows:
...
...
Q10: 30 % 10 = 0
You’ve answered 10 questions 10 of them are correct.
And your mark is 100.0%
...
...
Q4: 46 % 4 = 99
You’ve answered 4 questions 3 of them are correct.
And your mark is 75.0%
Example a. 100%
Example b. 75%
...
Q3: 26 % 8 = 88
You’ve answered 3 questions 2 of them are correct.
And your mark is 66.67%
Example c. 66.67%
Figure 7. Result Examples
Page 4
CON3602 Programming Fundamentals for Geomatics EA Project (50%)
The result should contain 1) how many questions have been asked, 2) how many questions are correct and 3) the percentage of correct answers. Note that, mark in percentage is required to set to 2 Decimal Places.
After Step 4 is completed, the program goes back to Step 1, the main menu again. Step 5: Good Bye
If we enter 9 in Step 1, the following Good Bye message will be shown.
Figure 8. Good Bye
Assumption
In Basic Stage, you may assume all inputs are in correct type and within correct range.
Hints:
1. Write a method to generate random numbers in a given range (i.e. start and end); this
method will be reused in Step 3.
2. Using methods help you to simplify the code and keep it tidy.
*** Main Menu ***
1) Remainder
2) Greatest Common Divisor (GCD) 3) Least Common Multiple (LCM) 9) Quit
>9
Good Bye!!
Page 5
CON3602 Programming Fundamentals for Geomatics EA Project (50%)
Advanced Stage (25%) (MathAdvanced.java)
Advanced Feature 1 (20%) – Two more operators:
Add two more choices in the main menu; they are Division and COMPLEX. If Division is selected, Step 3 generates division questions. If COMPLEX is selected, Step 3 generates questions with random operators.
Operands generated in Division and Complex should obey the following rules:
Operator
Operands
DIVISION
First operand should be between 1 and 100. First operand should be a composite number. First operand must be divisible by second operand.
Second operand should be between 2 and 40.
COMPLEX
Please random a number,
if it is an odd number, please generate: AB + C
If it is an even number, please generate: BA + C
A: should be between 1 and 5 B: should be between 2 and 4
C: should be between 1 and 60, should be a prime number
Following is a Test Run:
Welcome to IP Math Quiz
*** Main Menu ***
1) Remainder
2) Greatest Common Divisor (GCD)
3) Least Common Multiple (LCM)
4) Division
5) Complex
9) Quit
>5
Number of Questions: 3 Q1: 2 ^ 3 + 2 = 10
Q2: 4 ^ 4 + 19 = 275
Q3: 2 ^ 2 + 59 = 63
You’ve answered 3 questions 3 of them are correct.
And your mark is 100.0%
Welcome to IP Math Quiz
*** Main Menu ***
1) Remainder
2) Greatest Common Divisor (GCD)
Page 6
请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp