首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CS1083代做、代写Java设计编程
项目预算:
开发周期:
发布时间:
要求地区:
Module 9 Assignment
Worth 2% of your total course grade
CS1083 – Introduction to Computer Programming II (in Java)
Online Open Entry Version
Instructor: Andrew McAllister
Assignment Objectives
The purpose of this assignment is to give you practice:
• working with linked lists
General Instructions for All Assignments
• Follow the instructions in the document "Java Coding Guidelines.pdf" available
within the "Start Here" module, under the "Assignments" topic.
• For each .java file you create, include a javadoc comment (one that begins with
/**) at the beginning of the file that describes that Java class. This comment block
should include a line that begins with @author followed by your name and
student number on the same line. (Note: inclusion of this comment is part of the
instructions given in "Java Coding Guidelines.pdf")
• Include comments throughout your programs to explain any non-obvious portions
of your code.
• It is recommended that you create a separate folder on your computer for each
assignment. You might even wish to create separate sub-folders within an
assignment folder if the assignment has multiple parts. Keeping your work
organized makes it easier to find things later when you want to review what you
have done.
• Few things in life are more frustrating than losing your work while working on an
assignment. Get in the habit of saving frequently when working on an
assignment. Also, regularly make backup copies of any files you create as part of
your work for this course.
Assignment Guide
• Feel free to email your instructor if you need help in completing an assignment.
When you do so, please attach to the email a copy of *all* files required to
compile and run the program you are asking about, even if you downloaded
those files from D2L. (Otherwise the instructor will have to figure out what files
are missing and then go looking for them. Make it convenient to help you.) Also
describe the problem you are encountering and the specific help you would like
to receive.
• Submitting your assignment involves creating a pdf file and uploading that single
file to the assignment drop box on D2L. In general, that file will tend to include all
Java code you wrote for the assignment, plus any output from running your
programs that the assignment instructions specify you should capture. Specific
submission instructions are included at the end of each assignment.
• To create the pdf file for each assignment, begin by opening a new document
using the word processing program of your choice. Save the document using the
name “Your Name CS1083 Module x Assignment Submission.docx” Replace x
with the correct module number. “docx” may be different depending on which
word processing software you choose to use.
• If you don’t already have a word processor, UNB students are able to use
Microsoft Office 365 (includes Microsoft Word) for free, which can be accessed
by logging in to MyUNB.
• At the beginning of your submission document enter your name, your student
number, CS1083, the assignment name (this one is “Module 2 Assignment”), and
the date. It doesn’t matter if the date is when you started working on the
assignment or when you submit it – either will do.
• You can add content to your submission document as you work on the various
questions in the assignment. Clearly label each part of the assignment (“Part A”
etc.) in your document. Be sure to save frequently as you work on this document.
• When your document is complete, save / export it as a pdf file. Always make sure
your pdf file opens properly before uploading it.
• To include Java code in your submission document, copy all the text in your .java
file and then paste that text into your submission document. Use a monospaced
font (e.g.: Consolas , Courier ) for your code to maintain proper indentation.
Submitting code without proper indentation will result in marks being deducted.
It’s not enough that your code is indented in your text editor or in your integrated
programming environment – the indentation must show up that way in your
submission document as well. This sort of thing is part of learning to be an IT
professional.
• To include output from running your program in your submission document, the
preferred method is to copy and paste the text from your command prompt
window. Include the line with the “java” command you used to run your program.
If the text shows up as a weird font or colour in your submission document,
first paste the text into a blank text editor document, then copy and paste from
there into your Microsoft Word submission document. This will remove all
formatting from the text.
Use a monospaced font (e.g.: Consolas , Courier ) for output text in your
Word document. This will maintain alignment of your output.
• If at all possible, each line of code and each line of output should appear on a
single line in your submission document. Avoid allowing lines to “wrap” around
onto the next line. Use the tips provided in the “Avoiding Wrapped Lines” section
on the next page to accomplish this.
• To copy text from your command prompt window, try selecting the desired text
and then pressing either command-c (Mac) or control-c (Windows or Linux). If
you have issues, you can always use Google to see how to do this on your
specific type of computer.
• If a program involves graphical output (such as a JavaFX GUI program), capture
a screen shot of the output and include that as a picture / image in your
submission document.
Make sure the image includes only the relevant portion of the screen (such
as a GUI window). Capturing an image of your entire computer screen often
makes the relevant portion too small to see, with tiny text that is difficult to read.
This makes your assignment submission difficult to grade.
• To capture a screen shot of a selected portion of your screen, try command-shift4 (Mac), WindowsKey-shift-s (Windows), or shift-PrtScrn (Linux).
Avoiding Wrapped Lines
In the following example, the lines of code containing the comment and the println
statement are both too long. The text is formatted so those lines can't fit all on one line
in this document. This obscures the indentation and makes the code more difficult to
read.
import java.util.Scanner;
public class WrapExample
{ public static void main(String[] args)
{ double pay = hours * wage;
int dollars = (int) pay;
int pennies = (int) ((pay - dollars) * 100.0);
// First all * and / operations are performed, left to
right, then all + and - operations, left to right
System.out.println("\nThe pay for " + name + " is " +
dollars + " dollars and " + pennies + " cents.\n");
} // end main method
} // end class
Below is the same code, but reformatted so none of the statements wrap around onto
the next line. Several changes were made:
1. The font size (in the Word document) is changed to a smaller size,
2. The tab size (in the Word document) is reduced
3. The longer statements and long comments are broken up onto multiple lines (do
this in your text editor, in the .java file), and
4. If need be, you can change the orientation of your Word document from Portrait
to Landscape
Now the indentation of the code within the main method is easier to see.
import java.util.Scanner;
public class WrapExample
{ public static void main(String[] args)
{ double pay = hours * wage;
int dollars = (int) pay;
int pennies = (int) ((pay - dollars) * 100.0);
// First all * and / operations are performed, left to right
// Then all + and - operations, left to right
System.out.println("\nThe pay for " + name + " is " + dollars
+ " dollars and " + pennies + " cents.\n");
} // end main method
} // end class
Instructions – Part A – A Linked List of Numbers
The following files are provided for download earlier in this module:
• Node.java – A simple class for linked list nodes, where each node contains a
person’s name as a String.
• LinkedList.java – Contains some simple functionality for managing a linked
list of Node objects.
• ListTest.java – Performs simple testing for some of the functionality in the
LinkedList class.
All three of these classes will be updated as part of this assignment.
Update the Node class to store one int value in each Node instance, rather than a
name.
Update the LinkedList class to be consistent with your updated Node class.
Write a new testing class that does the following:
1. Create a new (empty) list using your updated LinkedList class.
2. Call the display method to display that empty list.
3. Use the insertInOrder() method to insert six randomly selected numbers between
1 and 49. Use the Random class to help generate each of those six numbers.
4. Call the display method to display your linked list of six numbers.
Include in Part A of your submission document:
• Complete code for Node.java, LinkedList.java, and your new testing class.
• Output from running your testing class twice.
Instructions – Part B – A Doubly Linked List of Numbers
1. Turn your updated list from Part A into a doubly linked list so Nodes are linked in
both directions, forward and backward. This entails:
• Adding a “previous” pointer to each Node object, along with getPrevious() and
setPrevious() methods in the Node class;
• Adding a “tail” pointer in the LinkedList class, along with a getTail() method;
and
• Updating whatever existing methods in the LinkedList class should be
changed so the values of “tail” and the “previous” pointers will be maintained
appropriately during all actions on the LinkedList.
2. Add a new instance variable called “size” to the LinkedList class. This variable must
keep track of the number of Nodes in the list at all times.
• Update the LinkedList constructor to set this variable appropriately when a
new list is created.
• Add a getSize() method that accesses the value of this variable. (Note: It
would not be appropriate to have a mutator method for this variable.)
• Update whatever existing methods in the LinkedList class should be changed
so the value of “size” will be maintained appropriately during all actions on the
LinkedList.
3. Add the following methods to the LinkedList class. Make sure all instance variables
in the Node and LinkedList classes are handled appropriately by these methods:
• insertAtHead(int num) – Inserts a new Node with the given number at the
beginning of the list. There is no need to check whether this operation keeps
the list in sorted order, nor is there any need to check whether this operation
results in duplicate numbers in the list.
• insertAtTail(int num) – Inserts a new Node with the given number at the end
of the list. There is no need to check whether this operation keeps the list in
sorted order, nor is there any need to check whether this operation results in
duplicate numbers in the list. (NOTE: This method should not include a loop.)
• removeAtHead() – removes the first Node in the list. Returns true if
successful, false otherwise (which should only happen when attempting to
removeAtHead() from an empty list).
• removeAtTail() – removes the last Node in the list. Returns true if successful,
false otherwise (which should only happen when attempting to removeAtTail()
from an empty list). (NOTE: This method should not include a loop.)
Update your testing class from Part A to test your updated Node and LinkedList classes
as follows:
1. Keep the four testing steps described in Part A (displaying the empty list, adding
and displaying six random numbers, etc.)
2. Use insertAtHead() to insert a randomly selected number between -100 and -50
at the head of the list. (The list should now contain seven nodes.)
3. Use insertAtTail() to insert a randomly selected number between 50 and 100 at
the tail of the list. (The list should now contain eight nodes.)
4. Call the display method to display your linked list of eight numbers.
5. Loop to call removeAtHead() three times.
6. Loop to call removeAtTail() three times.
7. Call the display method to display your linked list of what should now be two
numbers.
Include in Part B of your submission document:
• Complete code for your updated Node.java, LinkedList.java, and your updated
testing class.
• Output from running your updated testing class twice.
Instructions – Part C – An Updated LotteryTicket Class
Copy all the classes you wrote for the Module 2 Assignment to a new directory.
The LotteryTicket class you created for the Module 2 Assignment includes an array of
six randomly selected numbers between 1 and 49, without duplicates.
Update this LotteryTicket class to replace that array with a linked list of six randomly
selected numbers between 1 and 49, without duplicates. Use the Node and LinkedList
classes you updated for Part B to accomplish this.
This includes updating the following components of the LotteryTicket class:
• The constructor
• getNumbers()
• toString()
• chooseRandomNumbers()
• duplicateNumber(int i)
• countWinningNumbers(LinkedList winningNumbers)
The getWinningNumbers() method of the LotteryDraw class will also need to be
updated to return a reference to a LinkedList object rather than an array reference.
Test to make sure the LotteryDrawTest class you wrote for the Module 2 Assignment
still works with your updated LotteryTicket and LotteryDraw classes.
Include in Part C of your submission document:
• Complete code for your updated LotteryTicket and LotteryDraw classes.
• Output from running LotteryDrawTest twice.
Submission Instructions
Include the following in your submission document:
Your name, student number, CS1083, Module 9 Assignment, and the date.
Complete source code and testing output for each of Sections A, B, and C as
described above.
D2L DROPBOX SUBMISSION INSTRUCTIONS
Upload only one pdf file to D2L. Do not upload separate files (such as your .java
files) as they will be ignored. Upload your submission document as follows:
1. In the top-navigation bar on the course screen, select 'Assessments' and then
'Assignments'.
2. Select the assignment title and follow the instructions to upload your submission
document.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
urba6006代写、java/c++编程语...
2024-12-26
代做program、代写python编程语...
2024-12-26
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
热点标签
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
软件定制开发网!