Description
The a-s-s-e-s-s-m-e-n-t willdesign and programmingPlease see the questions shown in the screenshot. I will send you all the info after being hired, eg PPTs, student access etc. Please send a draft in 12hrs -1 day time, day 2, and day 3 as well. + Will need to draft some questions to ask the teacher and revise base on feedback (Send bk ard in 1 day max)
Unformatted Attachment Preview
KIT107 Programming
2024
Assignment 1
Due Date
This assignment is to be completed in pairs. The assignment is due at 11:55PM Wednesday
March 27th 2024 and should be completed with a partner. You and your partner should work
together on all of the design and programming. It should be done using the pairprogramming methodology and not by division of labour.
Use the “Assignment 1 Pairs” groups on MyLO to find and register your pair:
• if you already have a partner — start at the bottom of the list of pairs and when you
find an empty group, both you and your partner should enrol in that group.
• if you do not have a partner — start at the top of the list of pairs and when you find a
group with 0 or 1 member(s), add yourself to that group. If you are the second person
to join, you now have a partner and so email your partner to get started.
Background
The belligerent country of Kablamistan has launched an inter-continental ballistic missile
towards a country 8000km away which threatens to destroy the peaceful Goners who live
there.
Fortunately the United Nations has anticipated this possibility and, out of concern for the
citizens of Goneria, has placed a high-powered laser at the midpoint between the site of the
missile’s launch (Launchtown, Kablamistan) and the target (Doomsville, Goneria). The laser
is capable of destroying the missile in mid-air — even at its highest point of 20km above the
Earth.
Unfortunately the laser’s guidance system got fried when the soldier monitoring the system
blew its fuse when trying to cook a pop-tart with the laser and no replacement component
could be found. Given the military’s well known policy of awarding contracts to the lowest
bidder, you’ve been given the job of developing software to upload into the 80286 computer
that will be used to drive the laser! For free!
Also unfortunately, the missile is shielded against lasers and will need to be hit multiple times
before being destroyed.
The diagram below illustrates the situation.
Doomsville
(Goneria)
Launchtown
(Kablamistan)
1/6
The technical specifications are as follows:
• The missile
o is fired towards Doomsville at 12:30PM, i.e. at lunchtime in Launchtown!
o flies an elliptical path (with a major radius of 4000km and a minor radius of
20km) which is 7998km long. And
o travels each of the 180 x 1° segments in which it can be targeted by the laser
in 7.405s.
• The laser
o is 4000km between Launchtown and Doomsville directly below the path of
the missile;
o requires 15.757s to charge before it may be fired/re-fired;
o moves in 1° increments — where 0° is along the ground to Launchtown, 90° is
straight up, and 180° is along the ground to Doomsville;
o requires 3.91s to move 1° (and starts perpendicular to the ground, i.e. at 90°);
o should only be fired at degrees in the range 1–179°;
o may move while being charged; and
o fires instantly for an infinite distance.
Given an angle t in the range of 0–180° for the direction of the laser, the position of the
missile on its elliptical path is the coordinate (x,y) where x=4000*Math.cos(r) and
y=20*Math.sin(r). r is the value t converted to radians and the conversion can be
done with a built-in method: r=Math.toRadians(t);
If the missile will be at this coordinate at the time the laser is charged and aiming there then
this is a firing solution. Firing solutions consist of:
• the time the laser should be fired;
• the degree at which the laser should be aimed; and
• the resulting coordinate on the missile’s elliptical path at which impact with the
missile would occur.
Program specification
You and your partner must write a Java program to calculate and display all possible firing
solutions. These should be found from the greatest distance from Doomsville to the least
distance from Doomsville with the previous firing solution as the starting point for the next.
Your solution should comprise the following files:
• TimeInterface.java and Time.java — the Time ADT as used in lectures
and tutorials, extended with a method to add seconds to an existing time. The heading
for this additional function should be:
void addSeconds(double s);
Only the whole number portion of the double value should be added to the time
object;
• FiringSolutionInterface.java and FiringSolution.java — the
specification and implementation (respectively) of a firing solution. A firing solution
should be implemented as a class with instance variables which consist of:
o the time the laser should be fired (as a Time value);
o the degree at which the laser should be aimed (as an int); and
2/6
•
o the resulting coordinate at which impact with the missile would occur (as two
double fields, x and y).
and the operations should include a ‘getter’ and ‘setter’ method for each field; and
AssigOne124.java — the file which contains the main() method and other
functions which implement the required task. (There is no need to sub-divide
main() into additional methods.)
A starting point is available on MyLO for you to download. You should complete all the
required files. You may need nextLine() and nextInt() from
java.util.Scanner, print() and println() from java.lang.System,
compareTo() and charAt() from java.lang.String, valueOf() from
java.lang.Integer, and format() from java.text.DecimalFormat. You
will also need to use if and if-else statements, for and while loops, and perhaps type
coercions.
An example of the program’s output is shown below:
At time 12:33:56 PM, fire at 32 degrees to impact missile at (3392.192, 10.598)
At time 12:34:19 PM, fire at 35 degrees to impact missile at (3276.608, 11.472)
At time 12:34:41 PM, fire at 38 degrees to impact missile at (3152.043, 12.313)
At time 12:35:03 PM, fire at 41 degrees to impact missile at (3018.838, 13.121)
At time 12:35:25 PM, fire at 44 degrees to impact missile at (2877.359, 13.893)
At time 12:35:48 PM, fire at 47 degrees to impact missile at (2727.993, 14.627)
At time 12:36:10 PM, fire at 50 degrees to impact missile at (2571.150, 15.321)
At time 12:36:32 PM, fire at 53 degrees to impact missile at (2407.260, 15.973)
At time 12:36:54 PM, fire at 56 degrees to impact missile at (2236.772, 16.581)
At time 12:37:16 PM, fire at 59 degrees to impact missile at (2060.152, 17.143)
At time 12:37:39 PM, fire at 62 degrees to impact missile at (1877.886, 17.659)
At time 12:38:01 PM, fire at 65 degrees to impact missile at (1690.473, 18.126)
At time 12:38:23 PM, fire at 68 degrees to impact missile at (1498.426, 18.544)
At time 12:38:45 PM, fire at 71 degrees to impact missile at (1302.273, 18.910)
At time 12:39:07 PM, fire at 74 degrees to impact missile at (1102.549, 19.225)
At time 12:39:30 PM, fire at 77 degrees to impact missile at (899.804, 19.487)
At time 12:39:52 PM, fire at 80 degrees to impact missile at (694.593, 19.696)
At time 12:40:14 PM, fire at 83 degrees to impact missile at (487.477, 19.851)
At time 12:40:36 PM, fire at 86 degrees to impact missile at (279.026, 19.951)
At time 12:40:59 PM, fire at 89 degrees to impact missile at (69.810, 19.997)
At time 12:41:21 PM, fire at 92 degrees to impact missile at (-139.598, 19.988)
At time 12:41:43 PM, fire at 95 degrees to impact missile at (-348.623, 19.924)
At time 12:42:05 PM, fire at 98 degrees to impact missile at (-556.692, 19.805)
At time 12:42:27 PM, fire at 101 degrees to impact missile at (-763.236, 19.633)
At time 12:42:50 PM, fire at 104 degrees to impact missile at (-967.688, 19.406)
At time 12:43:12 PM, fire at 107 degrees to impact missile at (-1169.487, 19.126)
At time 12:43:34 PM, fire at 110 degrees to impact missile at (-1368.081, 18.794)
At time 12:43:56 PM, fire at 113 degrees to impact missile at (-1562.925, 18.410)
At time 12:44:18 PM, fire at 116 degrees to impact missile at (-1753.485, 17.976)
At time 12:44:41 PM, fire at 119 degrees to impact missile at (-1939.238, 17.492)
At time 12:45:03 PM, fire at 122 degrees to impact missile at (-2119.677, 16.961)
At time 12:45:25 PM, fire at 125 degrees to impact missile at (-2294.306, 16.383)
At time 12:45:47 PM, fire at 128 degrees to impact missile at (-2462.646, 15.760)
At time 12:46:10 PM, fire at 131 degrees to impact missile at (-2624.236, 15.094)
At time 12:46:32 PM, fire at 134 degrees to impact missile at (-2778.633, 14.387)
At time 12:46:54 PM, fire at 137 degrees to impact missile at (-2925.415, 13.640)
At time 12:47:16 PM, fire at 140 degrees to impact missile at (-3064.178, 12.856)
At time 12:47:38 PM, fire at 143 degrees to impact missile at (-3194.542, 12.036)
At time 12:48:01 PM, fire at 146 degrees to impact missile at (-3316.150, 11.184)
At time 12:48:23 PM, fire at 149 degrees to impact missile at (-3428.669, 10.301)
At time 12:48:45 PM, fire at 152 degrees to impact missile at (-3531.790, 9.389)
At time 12:49:07 PM, fire at 155 degrees to impact missile at (-3625.231, 8.452)
At time 12:49:29 PM, fire at 158 degrees to impact missile at (-3708.735, 7.492)
At time 12:49:52 PM, fire at 161 degrees to impact missile at (-3782.074, 6.511)
3/6
At time 12:50:14 PM, fire at 164 degrees to impact missile at (-3845.047, 5.513)
At time 12:50:36 PM, fire at 167 degrees to impact missile at (-3897.480, 4.499)
At time 12:50:58 PM, fire at 170 degrees to impact missile at (-3939.231, 3.473)
At time 12:51:21 PM, fire at 173 degrees to impact missile at (-3970.185, 2.437)
At time 12:51:43 PM, fire at 176 degrees to impact missile at (-3990.256, 1.395)
At time 12:52:05 PM, fire at 179 degrees to impact missile at (-3999.391, 0.349)
Algorithm
AssigOne124.java could implement the following algorithm:
o setting up the launch time
o iterating through each position (degree) of the missile from Launchtown to
Doomsville and for each
repeating the following steps until a solution is found or it is
determined there are no solutions
• calculating how the laser would need to move to get there
• calculating how the missile would need to move to get there
• determining how many seconds the movement of each item
would take and, if the laser can get there no later than the
missile
o determine the (x,y) coordinate of impact and the time
o create a firing solution of these values
o display the time and firing solution (you can make use
of the defined DecimalFormat objects to format the
output of Time and FiringSolution objects)
• otherwise
o moving the missile to the next location (degree)
Program Style
Your program should follow the following coding conventions:
• final variable identifiers should be used as much as possible, should be written all
in upper case and should be declared before all other variables
• variable identifiers should start with a lower case letter and use ‘camel-case’ format,
e.g. myVariable
• every if and if-else statement should have a block of code (i.e. collections of
lines surrounded by { and }) for both the if part and the else part (if used)
• every do, for, and while loop should have a block of code (i.e. {}s)
• the keyword continue should not be used
• the keyword break should only be used as part of a switch statement
• opening and closing braces of a block should be aligned
• all code within a block should be aligned and indented 1 tab stop (or 4 spaces) from
the braces marking this block
• instance variables should be used sparingly with parameter lists used to pass
information in and out of functions
• local variables (excluding loop counters) should only be declared at the beginning of
methods (either as parameters or otherwise)
• commenting:
o There should be a block of header comment which includes at least
file name
student names
student identity numbers
4/6
o
o
o
a statement of the purpose of the program
date
the percentage of the work completed by the authors — 50:50 is
expected and assumed but reasons should be given if it is more/less
than this
Each variable declaration should be on a single line and should be commented
There should be comments that identify groups of statements that do various
parts of the task
Comments should describe the strategy of the code and should not simply
translate the Java into English
Marking scheme
Task/Topic
Maximum
mark
Program submitted in form required
Program submitted correctly
Program compiles without error and runs to completion
1
1
Program operates as specified
Time.java correctly completed
FiringSolution.java correctly completed
AssigOne124.java correctly completed
2
9
11
Program Style
Does not unnecessarily repeat tests or have other redundant/confusing code
Uses final variables where appropriate
Uses pre-existing methods
(format/nextInt/nextLine/compareTo/valueOf/charAt/etc)
Uses correctly the Java naming conventions
Local variables declared at start of methods (other than loop counters)
Alignment of code and use of white space makes code readable
Always uses blocks in branch and loop constructs
Meaningful identifiers
Header comments for the program (author, purpose, date, filename etc)
Each variable declaration is commented
Comments within the code indicate the purpose of sections of code (but DO NOT just
duplicate what the code says)
3
2
2
2
2
2
2
2
2
3
2
What and how to submit
What to submit
• You should submit the three source files (Time.java, FiringSolution.java,
and AssigOne124.java) file. That is all that is required. Do not submit a RAR
file — it will not be marked.
How to submit
• Log in to MyLO and navigate to the Assignments tool under the Assessments
menu in the top tool bar.
• Select Assignment 1 from the list of available drop-boxes.
• Click on Add a File and follow the instructions to attach your source code files
and then click Add. Then click Submit.
5/6
If you want to re-submit, please just do so.
Please note: only one submission is required for the pair. You cannot submit as an
individual — only as a registered member of a pair. If you can’t see the Submission dropbox, it’s because you’re not registered in a pair. Fix that problem first.
Plagiarism and Cheating:
Practical assignments are used by the School of ICT for students to both reinforce and
demonstrate their understanding of material which has been presented in class. They have a
role both for assessment and for learning. It is a requirement that work you hand in for
assessment is your own.
Working with others
One effective way to grasp principles and concepts is to discuss the issues with your peers
and/or friends. You are encouraged to do this. We also encourage you to discuss aspects of
practical assignments with others. However, once you have clarified the principles of the
question, you must express them in writing or electronically entirely by yourself in your pair.
In other words you and your partner must develop the algorithm to solve the problem and
write the program which implements this algorithm yourselves. You can discuss the question
with others, but not the solution. Assistance with the solution should be provided by staff
during tutorials or consulting times.
Cheating
• Cheating occurs if you claim work as your own when it is substantially the work of
someone else.
• Cheating is an offence under the Ordinance of Student Academic Integrity within the
University. Furthermore, the ICT profession has ethical standards in which cheating
has no place.
• Cheating involves two or more parties.
o If you allow written work, program print-outs, or electronic versions of your
code to be viewed, borrowed, or copied by another student then you are an
equal partner in the act of cheating.
o You should be careful to ensure that your work is not left in a situation where
it may be used/stolen by others.
• Where there is a reasonable cause to believe that a case of cheating has occurred, this
will be brought to the attention of the unit lecturer. If the lecturer considers that there
is evidence of cheating, then no marks will be given to any of the students involved
and the case will be referred to the Head of School for consideration of further action.
Generative AI
Under the University’s Assessment and Results Procedure, all work that you submit as your
own must be your own work. You can use generative artificial intelligence (AI) to learn, just
like you would study with a classmate or ask a friend for advice — i.e. to learn concepts and
grasp principles. You are not permitted to consult generative AI tools (such as ChatGPT) to
learn how to complete assessment tasks, or to provide partial/full solutions to assessment
tasks. In particular, you are not permitted to present the output of generative AI as your own
work for your assignments or other assessment tasks. This constitutes an academic integrity
breach.
Julian Dermoudy, March 2nd 2024.
6/6
Purchase answer to see full
attachment