COMP 1010 Centre for Advance of Teaching and Learning
Course Title: Introduction to Computer Science 1
Part (1) Calculator with JOptionPane
For this part, you are going to develop a simple calculator which have these arithmetic
operators:
● + ⇒ this is addition
● - ⇒ this is minus
● * ⇒ this is multiple
● / ⇒ this is division
● % ⇒ this is not percentage! it is modulus which gives you the reminder
For this part of the assignment you are required to use these techniques:
1. import javax.swing.JOptionPane;
2. methods with a return type of double.
3. while loops
4. Using logical OR operator ||
5. Using logical AND operator &&
6. Use arguments (parameters) for all your methods. (passing your both numbers to the
methods). You are not allowed to define any variable outside of your methods.
“You can use other techniques which you have learnt so far in previous units such as if, else if,
else, etc.”. For this part, you do not need to have the draw () function.
you must create all the following method with the return type of double and use the suggested
names for your methods:
● add (double number1, double number2) for Addition
● minus (double number1, double number2) for Subtraction
● multiply (double number1, double number2) for Multiplication
● divide (double number1, double number2) for Division
● modul (double number1, double number2) for Modulus
You are required only to call one method in your setup (), and that is a void method that is called
process () that has no parameters, you should not have any variables inside your setup.
However, you can create your variables in the process () method. So, your setup () must be
identical to the following code:
void setup ()
{
process ();
}
Your output must be something similar to the figure below after running your program.
Run your program and ask the user to enter the first number:
Assignment 3
COMP 1010 Centre for Advance of Teaching and Learning
Course Title: Introduction to Computer Science 1
Term: Winter 2017
After pressing OK, your system must show this input message which is asking for choosing
arithmetic operators:
I entered *
After this window your system needs to show the window which asks for the second number:
number 55 has been entered
Now your system must calculate the result and print it like this on the screen:
Assignment 3
COMP 1010 Centre for Advance of Teaching and Learning
Course Title: Introduction to Computer Science 1
Term: Winter 2017
As you can see the result is 1265.0 which is a double primitive data type.
Next task is to ask your user if he/she wants to continue using your software.
I answered yes in here and kept using the program
So now your system must again ask for the first number
this time you see, there is no welcome message in this window, and number 8.5 has been
entered as the first number.
now it’s the time for asking the arithmetic operator:
Assignment 3
COMP 1010 Centre for Advance of Teaching and Learning
Course Title: Introduction to Computer Science 1
Term: Winter 2017
we want to divide now
and here we ask for the second number:
and as usual, after clicking on OK button, you can see the result.
Now your system must ask again (your while loop) if you want to continue or not!
Assignment 3
COMP 1010 Centre for Advance of Teaching and Learning
Course Title: Introduction to Computer Science 1
Term: Winter 2017
The square laser maze
Consider a sample laser maze shown on the left below:
In maze 1, the orange laser beam starts from coordinates (1,2) with laser going along the
East direction. The laser first hits a single‐sided mirror at (2,2), and then travels North, hits a
double‐sided mirror at (2,4), and then goes East, hits another double‐sized mirror at (5,4),
and direction changes to South. Finally, arriving the destination at (5,3). The green laser
beam starts from (0,3) with laser going along the East direction. If you follow the path of the
laser beam, you will notice the laser hits a few mirrors and finally arriving the destination at
(4,1).
In maze 1, both laser beams arrive at a destination. On the other hand, all beams in maze 2
cannot reach a destination. The orange laser beam goes off the boundary, the green laser
beam is blocked at (2,5) and cannot go further, and the red laser beam is blocked at (3,0) as
well.
A typical laser maze contains these items:
At least 1 and at most 5 laser beam sources. Laser beam source will point to one of
these directions: North, East, South, West.
At least 1 and at most 5 destinations. Number of destinations can be different from
the number of sources.
Zero or more single‐sided mirrors. There are 4 kinds of single‐sided mirror, facing
NW, SE, SW, or NE.
Zero or more double‐sided mirrors. There are 2 kinds of double‐sided mirror.
Zero or more laser blocks. This is the cross shown in maze 2 above. A laser block will
stop any laser beam at the space that it is located.
Note that in a laser maze, there will be at most 20 items, and no two items share the same
coordinates. Smallest possible laser maze is 2x2.
x
y
0 1 2 3 4 5 6
6
5
4
3
2
1
0
Maze 1 Maze 2
ENGG1111 A1 2016/17
‐2‐
Converting the graphical maze into words
Somehow the laser maze needs to be entered into the program. We will give each item in
the laser maze a name. Below is the conversion table:
Listing 1: “Hello World!” in LC-3.
The above listing is a typical hello world program written in LC-3 assembly language. The program
outputs “Hello World!” to the console and quits. We will now look at the composition of this
program.
Lines 1 and 2 of the program are comments. LC-3 uses the semi-colon to denote the beginning
of a comment, the same way C++ uses “//” to start a comment on a line. As you probably already
know, comments are very helpful in programming in high-level languages such as C++ or Java. You
will find that they are even more necessary when writing assembly programs. For example in C++,
the subtraction of two numbers would only take one statement, while in LC-3 subtraction usually
takes three instructions, creating a need for further clarity through commenting.
Line 3 contains the .ORIG pseudo-op. A pseudo-op is an instruction that you can use when
writing LC-3 assembly programs, but there is no corresponding instruction in LC-3’s instruction
set. All pseudo-ops start with a period. The best way to think of pseudo-ops are the same way you
would think of preprocessing directives in C++. In C++, the #include statement is really not a C++
statement, but it is a directive that helps a C++ complier do its job. The .ORIG pseudo-op, with its
numeric parameter, tells the assembler where to place the code in memory.
Memory in LC-3 can be thought of as one large 16-bit array. This array can hold LC-3 instructions or it can hold data values that those instructions will manipulate. The standard place for code
to begin at is memory location x3000. Note that the “x” in front of the number indicates it is in
hexadecimal. This means that the “.ORIG x3000” statement will put “LEA R0, HW” in memory
location x3000, “PUTS” will go into memory location x3001, “HALT” into memory location x3002,
and so on until the entire program has been placed into memory. All LC-3 programs begin with the
.ORIG pseudo-op.
Lines 4 and 5 are LC-3 instructions. The first instruction, loads the address of the “Hello World!”
Revision: 1.17, January 20, 2007 viiProgramming in LC-3
string and the next instruction prints the string to the console. It is not important to know how these
instructions actually work right now, as they will be covered in the labs.
Line 6 is the HALT instruction. This instruction tells the LC-3 simulator to stop running the
program. You should put this in the spot where you want to end your program.
Line 7 is another pseudo-op .STRINGZ. After the main program code section, that was ended
by HALT, you can use the pseudo-ops, .STRINGZ, .FILL, and .BLKW to save space for data that
you would like to manipulate in the program. This is a similar idea to declaring variables in C++.
The .STRINGZ pseudo-op in this program saves space in memory for the “Hello World!” string.
Line 8 contains the .END pseudo-op. This tells the assembler that there is no more code to assemble. This should be the very last instruction in your assembly code file. .END can be sometimes
confused with the HALT instruction. HALT tells the simulator to stop a program that is running.
.END indicates where the assembler should stop assembling your code into a program.
Syntax of an LC-3 Instruction
Each LC-3 instruction appears on line of its own and can have up to four parts. These parts in order
are the label, the opcode, the operands, and the comment.
Each instruction can start with a label, which can be used for a variety of reasons. One reason
is that it makes it easier to reference a data variable. In the hello world example, line 7 contains
the label “HW.” The program uses this label to reference the “Hello World!” string. Labels are also
used for branching, which are similar to labels and goto’s in C++. Labels are optional and if an
instruction does not have a label, usually empty space is left where one would be.
The second part of an instruction is the opcode. This indicates to the assembler what kind of
instruction it will be. For example in line 4, LEA indicates that the instruction is a load effective
address instruction. Another example would be ADD, to indicate that the instruction is an addition
instruction. The opcode is mandatory for any instruction.
Operands are required by most instructions. These operands indicate what data the instruction
will be manipulating. The operands are usually registers, labels, or immediate values. Some instructions like HALT do not require operands. If an instruction uses more than one operand like LEA in
the example program, then they are separated by commas.
Lastly an instruction can also have a comment attached to it, which is optional. The operand
section of an instruction is separated from the comment section by a semicolon.
LC-3 Memory
LC-3 memory consists of 216 locations, each b
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab08 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab07 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
2048 is a recent online computer game. Play takes place on a 4x4 board of squares on which a
sequence of tiles appears, each holding a number. Players move tiles around by sliding rows and
columns, with the aim of combining identical tiles to make higher numbers. The player's score is
determined largely by the tiles on the final board.
You can play 2048 online to get familiar with the game. In this project you will construct a computer
player for a simplified version of
浏览:838
This assignment aims to give you some experience with C programming and to help you gain
better understanding of the addressing mode of LC-3.
Important Notes
? There are subtle differences between various C compilers. We will use the GNU compiler gcc
on login.cs.auckland.ac.nz for marking. Therefore, you MUST ensure that your submissions
compile and run on login.cs.auckland.ac.nz. Submissions that fail to compile or run on
login.cs.auckland.ac.nz will attract NO marks.
? Markers will compile your program using command “gcc –o name name.c” where name.c is
the name of the source code of your program, e.g. part1.c. That is, the markers will NOT use
any compiler switches to supress the warning messages.
? Markers will use machine code that is different from the examples given in the
specifications when testing your programs.
? The outputs of your programs will be checked by a program. Thus, your program’s outputs
MUST be in the same format as shown in the example given in each part. You must make
sure that the registers appear in the same order as shown in the example and there are no
extra lines.
In this assignment, you are required to write C programs to implement a LC-3 simulator. That is,
the programs will execute the binary code generated by LC-3 assembler.
Part 1 (28 marks)
LC3Edit is used to write LC-3 assembly programs. After a program is written, we use the LC-3
assembler (i.e. the “Translate ? Assemble” function in LC3Edit) to convert the assembly
program into binary executable. The binary executable being generated by LC3Edit is named
“file.obj” where “file” is the name of the assembly program (excluding the “.asm” suffix). In this
specification, a “word” refers to a word in LC-3. That is, a word consists of two bytes. The
structure of the “file.obj” is as below:
? The first word (i.e. the first two bytes) is the starting address of the program.
? The subsequent words correspond to the instructions in the assembly program and the
memory locations reserved for the program using various LC-3 directives.
? In LC-3, data are stored in Big-endian format (refer to
https://en.wikipedia.org/wiki/Endianness to learn more about Big-endian format). For
2
example, if byte 0x12 in word 0x1234 is stored at address 0x3000, byte 0x34 is stored at
address 0x3001. This means, when you read a sequence of bytes from the executable of
an LC-3 assembly program from a file, the most significant bit of each word is read first.
In this part of the assignment, you are required to write a C program to display each word in the
“.obj” file of a program in hexadecimal form.
? Name the C program as “part1.c”.
? The name of the “.obj” file (the name of the file INCLUDES the “.obj” suffix) must be
given as a command line argument.
? In the output, each line shows the contents of one word.
? The value of each word must have a “0x” prefix.
? The letter digits “a” to “f” must be shown as lowercase letters.
Here is an example of the execution of the program. In this example, the LC-3 assembly program
is as below. The name of the executable of the assembly program is “p1.obj” (markers will
probably use a file with a different name and different contents).
.ORIG X4500
LD R0, A
LEA R1, B
LDI R2, C
AND R3, R0, R1
AND R3, R1, #0
NOT R4, R3
ADD R4, R4, #1
BRp F
ADD R3, R3, #1
F HALT
A .FILL X560A
B .FILL X4507
C .FILL X4501
.END
The execution of the program is shown below. The command line argument is marked in red.
$ ./part1 p1.obj
0x4500
0x2009
0xe209
0xa409
0x5601
0x5660
0x98ff
0x1921
0x0201
0x16e1
0xf025
0x560a
0x4507
3
0x4501
Part 2 (46 marks)
In this part, you are required to write a C program to implement a LC-3 simulator that is capable
of executing instruction “LD”.
? Name the C program as “part2.c”.
? The name of the “.obj” file (the name of the file INCLUDES the “.obj” suffix) must be
given as a command line argument.
? The state of the simulator consists of the contents of the 8 general purpose registers (i.e.
R0 to R7), the value of the program counter (i.e. PC), the contents of the instruction
register (i.e. IR), and the value of the condition code (i.e. CC).
? The values in R0 to R7, PC and IR should be shown as hexadecimal value. The value of CC
is either N, Z or P.
? Before the simulator starts executing a program, it should first display the initial state of
the LC-3 machine. In the initial state, R0 to R7 and IR should all be 0; PC should be the
starting address of the program to be executed; and CC should be set to Z.
? When displaying the value of R0 to R7, PC, IR and CC, a tab character (denoted as “\t” in
Part A: MinMax Search and Alpha-Beta Pruning (10 points) [Must be handed in individually]
These are problems to work out on paper and hand it as a document HW10.txt
. When you are asked to insert values into the tree, you may draw a diagram using "ASCII Art", or you may simply list the values in a breadth-first (level by level) transversal of the nodes in the diagram.
In this assignment we will implement a vector computation engine that is able to construct vectors
and perform vector computations in the Java programming language. Your task is to implement the
incomplete functions in the provided scaffold code based on the included examples and documentation.
You are encouraged to ask questions on Ed using the assignments category. As with any assignment,
make sure that your work is your own, and you do not share your code or solutions with other students.
Working on your assignment
You can work on this assignment on your own computer or the lab machines. Students can also take
advantage of the online code editor on Ed. Simply navigate to the assignment page and you are able to
run, edit and submit code from within your browser. We recommend that you use Safari or Chrome.
It is important that you continually back up your assignment files onto your own machine, flash drives,
external hard drives and cloud storage providers. You are encouraged to submit your assignment while
you are in the process of completing it. By submitting you will obtain some feedback of your progress.
浏览:817
Write C++ code that will convert files into a queue of packets and reassemble a queue of packets back into the original file. Both of these functions will be used in homework 8 where we will simulate sending files through a network as packets and reassembling them at their destinations.
A peristent data structure is one in which we can make changes (such as inserting and removing elements) while still preseving the original data structure Of course, an easy way to do this is to create a new copy of the entire data structure every time we perform an operation that changes the data structure, but it is much more efficient to only make a copy of the smallest possible portion of the data structure.
In the remaining problems, you will develop a realistic program which implements a text-retrieval system similar to Google.
You will extend a basic program called Minipedia that maintains a database of articles on various subjects. We supply a folder of >2500 articles culled from Wikipedia (first paragraphs only), two test articles Test1 and Test2, and also the code to access this collection. The basic user interaction is provided, as well as a bare-bones implementation of the database as a dumb unordered list. You must extend the functionality in several interesting ways, and also provide a more intelligent data structure using a hash table.
In this assignment you are to prepare a C/Objective-C program that will act as a simple
calculator. The calculator will be run from the command line and will only work with integer
numbers and the following arithmetic operators + - x / %. The % operator is the
modulus operator, not the percentage.
For example, if the C/Objective-C program is compiled to calc, the following demonstrates
how it will work
./calc 3 + 5 - 7
1
In the command line, the arguments are a repeated sequence in the form
number operator
and ending in a
number
Hitting the enter key will cause the program to evaluate the arguments and print the result.
In this case 1.
The program must follow the usual laws of arithmetic which says
1. The x / and % operators must all be evaluated before the + and – operators.
2. Operators must be evaluated from left to right.
For example, using Rule 1
2 + 4 x 3 – 6
becomes
2 + 12 – 6
which results in
8
Assignment 1 – Autumn 2016 Page 2 of 6
If we did not use Rule 1 then 2 + 4 x 3 – 6 would become 6 x 3 – 6 and then 18 – 6 and finally
12. This is an incorrect result.
If we do not use Rule 2 then the following illustrates how it can go wrong
4 x 5 % 2
Going from left to right we evaluate the x first, which reduces the expression to 20 % 2
which becomes 0. If we evaluated the % first then the expression would reduce to 4 x 1
which becomes 4. This is an incorrect result.
Remember, we are using integer mathematics when doing our calculations, so we get
integer results when doing division. For example
./calc 20 / 3
6
Also note that we can use the unary + and –
浏览:796
Suppose you want to develop and play a PC-based, single-user, simplified version of battleship (google “battleship game” if you aren’t familiar with it). Just like with most single-user games, you will not play against a real opponent, but rather against a simulated opponent, whose initial map is stored in a text file containing a description of where your opponent’s ships are located The idea is that when your program starts, it will read the description of the opponents map from the file and store it in a 2-d array. The person playing the game, of course, will not see the file or the 2-d array, except at the end of the game. Throughout the game, the player repeated trys to guess where battleships are located by specifying individual map coordinates (just like in the actual game). For each guess, the program will tell the player if they hit or miss. After each time the player makes a guess, the program will print out an “ASCII art” representation of the playing field (the currently known portion of the map). This will allow the player to see their progress as they play the game.
CS 158/159
This assignment is worth 15 points and will be due Monday November 23, 2015 at 11:00pm. All
assignment deadlines are firm and the ability to submit your assignment will be disabled after the
deadline elapses. No late work will be accepted. You are encouraged to start this assignment as soon as
In this assignment, you'll create your own library of string functions.
You'll have the opportunity to practice manipulating strings and
managing memory. Additionally, you'll learn the role of header and
CS:2230 Computer Science II: Data Structures
Instructions
1 Types in college
In this problem, you are to implement the following classes types in package
edutypes: Instructor, Professor, Student, TeachingAssistant. The
Department of Computer Science Intro to Parallel Computing Programming Sets Recall that a set is just a collection of objects. The order in which the objects are listed doesn’t matter. So the set A = {3, 1, 2} is the same as the set B = {2, 3, 1}. Repetitions also don’t matter. So the sets A and B are the same as the set C = {3, 1, 2, 1}. The union of two sets D and E is the set whose elements are the elements that belong to D, to E, or to both D and E. For example, if D = {1, 3, 5, 7} and E = {1, 2, 3, 4}, then their union is D ∪ E = {1, 3, 5, 7} ∪ {1, 2, 3, 4} = {1, 2, 3, 4, 5, 7}. The intersection of two sets D and E is the set of elements that they have in common. So the intersection of the sets D and E is D ∩ E = {1, 3, 5, 7} ∩ {1, 2, 3, 4} = {1, 3}. The difference of two sets D and E is the set of elements belonging to the first, but not the second. So the difference of the sets D and E is D − E = {1, 3, 5, 7} − {1, 2, 3, 4} = {5, 7}. Program 2 For programming assignment 2, you should write a C program that implements a set abstract data type with operations union, intersection and set difference. Input to the program will be a sequence of single characters separated by white space. These indicate which operations should be carried out: ’u’ or ’U’: Find the union of two sets, ’i’ or ’I’: Find the intersection of two sets, and ’d’ or ’D’: Find the difference of two sets. ’q’ or ’Q’: Quit (freeing any allocated memory), For the union, intersection, or difference, the user will enter two sets A and B, and your program should output the result of the operation on the sets. The elements of the sets will be nonnegative ints, listed in increasing order, without repetitions. The last element in an input set will be followed by a negative value. For example, the set D = {1, 3, 5, 7} would be entered as 1 1 3 5 7 -1 You can assume that input sets will be sorted lists of nonnegative ints in increasing order with no duplicates, and each input set will be terminated by a negative value. So you don’t need to check the input sets for correctness. Implementation Details Each set should be implemented as a sorted, singly linked list of ints, and there should be no repeated values in the stored linked list. So D should be stored as head_p -> 1 -> 3 -> 5 -> 7 \ (The backslash (\) denotes the NULL pointer.) The set D should not be stored as head_p -> 3 -> 1 -> 7 -> 5 \ or head_p -> 1 -> 3 -> 3 -> 5 -> 7 \ Note that the restriction that the lists are sorted and that they don’t store duplicates doesn’t mean that we can’t accurately represent sets: any set of nonnegative ints can have its elements listed in increasing order with no repeated values. The purpose of the restrictions is to reduce the complexity of the program’s internal storage, and to make it possible to efficiently implement the operations. Since the sets are stored in sorted order, all three operations can be implemented as variations on the merge operation. Recollect that we merge two sorted lists by comparing the elements of the list pairwise and appending the smaller element to the new list. If the input lists are A and B, and the merged list is C, we can define pointers a_p, b_p and c_p that reference the current element in each list, respectively. So the merge operation proceeds as follows: while (a_p != NULL && b_p != NULL) if (a_p->data <= b_p->data) { c_p = Append(&C, c_p, a_p->data); a_p = Advance(a_p); } else { // b_p->data < a_p->data c_p = Append(&C, c_p, b_p->data); b_p = Advance(b_p); } while (a_p != NULL) { c_p = Append(&C, c_p, a_p->data); a_p = Advance(a_p); 2 } while (b_p != NULL) { c_p = Append(&C, c_p, b_p->data); b_p = Advance(b_p); } You should use this algorithm as the basis of your implementations. Note that at no point do you sort any of the lists! Each of the set operations, A ∪ B, etc., should be implemented by a function. These functions should not change the input arguments A and B. If the result of the operation (e.g., C) is passed in to the function (instead of being created and returned by the function), then, of course, the function can change it. Note that none of the functions implementing the operations should do any I/O (except for debug I/0). The results should be printed by the calling function (e.g., main). Since each new operation in the program reads in new sets, your program won’t be reusing the elements of the sets involved in the previous operation. So if you don’t free the nodes in each of the lists after printing the results of an operation, your program will have a memory leak: memory allocated from the heap will be lost. Development You should compile and test your program using Linux, since the parallel computers we have access to all use Linux (rather than Windows or MacOS X). Working with linked lists and pointers can be confusing
Description
In this assignment, you will use doubly and singly linked lists. You will add new functionality to our original singly linked and doubly linked list implementations. For the second part of the assignment, you will create JUnit tests to make sure that all of your methods are implemented correctly.
CompSci 251: Piece Positioning
1 Overview
This assignment will add a handful of classes, allowing the board to track the position of chess pieces. A test
driver is supplied which allows two players (on one computer) to take turns moving one of their own pieces
Object-Oriented Applications
The Airline Reservation Application
For this assignment, you will individually develop an Airline Reservation Application in Java enabling
airlines to view the seating map of a flight and to make seat reservations in first or economy class,
COMPSCI 711
The purpose of this assignment is to understand the techniques used by the CDN in
reducing the amount of data transmission and practice developing distributed applications.
The system consists of three components as shown in the figure below.
CS 455 Programming
In this assignment you will get practice working with Java arrays, and more practice implementing your own classes. Like you did in assignment 1 and lab 4, you will be implementing a class whose specification we have given you, in this case a class called SolitaireBoard, to represent the board configuration for a specific type of solitaire game described further below. You will also be using tools to help develop correct code, such as assert statements along with code to verify that your class is consistent.
CSCI203
Your task for this assignment is to investigate some of the properties of queues.
You should write a program which simulates the queuing and service of a set of requests.
Input consists of the following data:
CSE 17
Not so long ago, text messages could only be sent using the numeric key pad of the cell phone. Even
today, less expensive phones rely on this means for texting. In this assignment, we will look at the
problem of decoding text messages using the T9 system. Unlike the multi-tap system, T9 requires only a
CSE 17
In this assignment, we will explore recursion while developing a simple data structure to
represent the mathematical concept of a set. You should not use java.util.Set nor any of its
descendants when writing this program. The UML for your class is given below. You may create
CSE 17
Program Files (8): AtmTransaction.java, BankAccount.java, CheckingAccount.java,
CheckTransaction.java, DepositTransaction.java, FeeTransaction.java,
Transaction.java, WithdrawalTransaction.java
For this assignment, you will write a program to support the tracking of a checking account. This program
You should be comfortable with the content in the modules up to and including the module "Input Output" for this project.
You must follow the style guide for all projects.
Download the text file weblog.txt
You should be comfortable with the content in the modules up to and including the module "Interactivity" for this project.
For this project, you will create a program that calculates the number of available seats on the Airbus A380 airplane that has a maximum seating capacity of 555. The program is intended for airline ticketing agents. The agent should be prompted for the number of ticketed passengers and the number of employee complimentary passes that have been assigned. The program should add together these two numbers and subtract them from the capacity, then display the total as the number of available seats in the airplane.
You must follow the style guide for all projects.
The manager of a private club's golf course is having some trouble understanding his customer attendance. The manager's objective is to optimize staff availability by trying to predict when members will play golf. To accomplish that he needs to understand the reason members decide to play and if there is any explanation for that. He assumes that weather must be an important underlying factor, so he decides to use the weather forecast and record whether or not members play golf under certain weather conditions. Over the next two weeks he keeps records of:
For this project, you will create a program that asks the user to enter a positive integer value less than 20.
If the user enters a number greater than 20, the user should get an error.
If the user enters a number equal to or less than 20, display the double of each value beginning with 1 up to the selected number (multiply each number by 2), then provide the total of all doubles.
You should be comfortable with the content in the modules up to and including the module "Arrays" for this project.
Create a class called consultCo that holds a private struct called employee that contains the name, pay rate and social security number of an employee of a consulting firm called consultCo. The consultCo class should also have an array that holds all of the objects of all of the employees in the array. This will be an array of employee objects. Note: You cannot use a vector for this assignment--you must use an array.
CE2001/CZ2001 Algorithms
General Notes for Example Classes 2 – 4
The next three example classes intend to reinforce your understanding of algorithms
through hands-on experience of implementation and empirical analysis.
CE2001/CZ2001 Algorithms
General Notes for Example Classes 2 – 4
The next three example classes intend to reinforce your understanding of algorithms
through hands-on experience of implementation and empirical analysis.
Department of Computing and Information Systems
COMP10002 Foundations of Algorithms
Semester 2, 2014
Assignment 2
Learning Outcomes
In this project you will demonstrate your understanding of dynamic memory and linked data structures.
CS240
Lab4: Basic I/O, Implementing an RPN Calculator, Number Conversion
Goal:
In this lab you will write programs that use basic I/O, implementing a command line RPN calculator, and number conversion.
a Resizable Table, a Linked List, and a Word Count Program.
Goal
In this lab you will practice dynamic memory, pointers, and strings by implementing a table and a linked list that can be used to store name, value pairs. Additionally, you will implement your own string routines and implement a word counter program.
1. Implement a value returning function QUESTION1(N) to compute the error in the series approximation y = e^x = 1 + x + (x^2)/2! + (x^3)/3! + … up to m terms for a user defined integer value of m. Illustrate with x = 0.5 and m=6. The data types for x and y must be double. Each term in the series must be computed as a double. The exact value of the y must be computed using the exp() function from <math.h> <20 marks>
COMP 2140 Assignment 2: A Run-time Stack and Merge Sorting a
Linked List
Helen Cameron and Stephane Durocher
Due: Wednesday October 22 at noon
Programming Standards
When writing code for this course, follow the programming standards, available on this course's website on
Data Structures and Algorithms
COMP 2140
Department of Computer Science
University of Manitoba
Assignment 4: Trees due Wednesday November 19 by 12:00 pm (noon)
Objective
This assignment deals with binary trees. An instance of the class BinaryTree is a binary
COMP 2140 Assignment 5: 2-3 Tree Insertions and Heap Sort
Helen Cameron and Stephane Durocher
Due: Wednesday December 3 at noon
Programming Standards
When writing code for this course, follow the programming standards, available on this course's website on
CS110 Project 3
Bob Wilson
Writing a Class “from Scratch” to Satisfy a Provided API and JUnit TestCase
Some applications involve linear equations such as:
ax + by = c
CS110 Project 1
Bob Wilson
Solving Quadratic Equations
We want to write and test a program for solving a quadratic equation of the form:
a x2 + b x + c = 0
1. Answer each of the following questions about the application:
a) In the original application, what were the different ways that NumberFormatException and IOException are handled?
The former use the method of calling a function to prompt the user and the later use the method of throwing an exception
1. Answer each of the following questions about the application:
a) Why did the author of the software decide to create a Price class and its sub classes: RegularPrice and ChildrenPrice instead of creating subclasses RegularMovie and ChildrenMovie of the Movie class.
CS 110: Introduction to Computing with Java
CS 110: Introduction to Computing with Java
CS 110: Introduction to Computing with Java
CS 110: Introduction to Computing with Java
Lab 4
Pre-Lab
Do the following exercises before coming to lab.
1. What is printed by the following Java statements:
CS 110: Introduction to Computing with Java
Lab 3
Pre-Lab
Write your answers for the following exercises before coming to lab. First, you should try to figure out the answer without entering and running the code. Then, you can use Dr Java to enter and run the code to check your answers.
1
COMP5214 Software Development in Java Assignment Semester2, 2014
Electronic Inventory Records Management (EIRM)
SIT221
Classes, Libraries and Algorithms
Work submitted late without documented approval of the Unit Chair or Lecturer will be
penalised. Assignments that are submitted after the submission date will be subject to a mark
ECE 263/ECE 264
Create the followingstructure:
WASIM AKBER Engineering Department ENGR 334
ENGR 334
Programmable
Systems
ENGR 334
Programmable Systems WASIM AKBER Engineering Department 2
ENGR 334
Implement the Graph ADT in C# using the Graph class stub supplied on Desire2Learn. Make sure that each of your class methods is functional! You may add members to the Graph class, but do not add class variables which are for local use only, and do not change the names or signatures of the methods given in the stub; and do not add to the public interface. Make sure that your name appears in a comment at the top of each source file. Test your Graph class using Test Plan #2. Submit your source code and your test results in separate files, after first compressing them into a single file using the built-in Windows file compression utility.
In a namespace called Lab5, write C# classes called RootedBinaryTree and Compressor using the supplied code stub.
The huffman method should accept an array of Word objects with the plainWord and probability fields filled in, and return the same array with the codeWord fields also filled in according to Huffman's Algorithm. In implementing Huffman's Algorithm, make use of the RootedBinaryTree class. Note that RootedBinaryTree should perform shallow copying to reduce the time- and space-complexity of tree operations.
Write a class called "Person" that contains several fields, including "lastName", "SSN", and "birthDate" fields; note that SSN should not be a numeric field, since we do not perform arithmetic with SSNs. The Person class should implement the IKeyed interface (see code below). Then write a class called "HashTable" providing the functionality of a hash table. Use the following stub to get started:
Write a class called "Person" that contains several fields, including "lastName", "SSN", and "birthDate" fields; note that SSN should not be a numeric field, since we do not perform arithmetic with SSNs. The Person class should implement the IKeyed interface (see code below). Then write a class called "HashTable" providing the functionality of a hash table. Use the following stub to get started:
Complete the implementation of the ChessGame class. You will need to download the following zipped file:
GraphicChess - Lab 6 Version.zip
You should only modify the ChessGame.cs source file. Search for "YOUR CODE HERE" to find the spots that need work.
Electrical & Computer Engineering Department, University of Maryland, College Park
Integer Arithmetic Expression Evaluator
Project Objective:
1. get familiar with the process of completing a programming project.
Week 10 Laboratory
A comment about exercise 5 below:
it requires you to demonstrate to your tutors that you have completed Stage 1 of the assignment. You do not have submit any code.
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab10 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
Week 8 Laboratory
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab08 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
Week 7 Laboratory
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab07 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab06 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
Week 5 Laboratory
We have created some scripts that can automatically run your program against some tests. To run these tests you can execute the dry run program with an argument that corresponds to the lab and week, i.e. lab05 for this week. It expects to find all the programs to be submitted as part of this lab in the current directory. You can use dry run as follows:
COMP1921 14s2 Assignment
Image Processing with Quad-Trees
Aims
This exercise aims to give you practice in dealing with dynamic data structures, specifically lists and trees. The goal is to complete the implementation of a small program that can do simple image processing.
(I) Write a function or functions to evaluate the Black-Scholes functions for Put and Call. Test it by verifying the
Put-Call parity relationship. Perform the test on a variety of different values of r, , S0, and T - t. (Take q = 0.)
COMPSCI 386 Optional Homework
The purpose of this assignment is to investigate SRTF (Shortest Remaining Time First) scheduling through
deterministic modeling in Java. For simplicity we are ignoring dispatch latency and assuming that each
Convert your Matlab statistics functions to C.
Place all of the function in a single file (as this makes it much easier for me to grade). Convert the top-level routine (e.g., my_stats) to be the main (driver) routine. The main will call (exercise) all of the functions and display the output. Read the file "number_list.txt" to populate the list vector/array.
It will be easiest if you convert the routines one at a time.
mean (my_mean)
maximum (my_max)
minimum (my_min)
range (my_range)
median (my_median)
mode (my_mode)
variance (my_var)
standard deviation (my_std)
Make all of the functions return a double.
Have the mode return only a single mode.
The variance and standard deviation may be for the full population or a sample (to match Matlab use the one for a sample).
If you made use of some of the Matlab functions such as "sum", you will have to replace them with the appropriate code; better yet, replace this kind of function with one of your own much like you did previously with the "sort" function.
Requirements: Choose ONE of the following projects and follow all of the directions in this project
specification for that project. You will be in a team with people who chose the other projects.
This Final Project has a Presentation Requirement that must be given during the scheduled time of the Final
Here is my typed up version of the problem. I have tried to elaborate a bit on the book description of the problem, but if you have any questions just send me an email.
Design a class House that defines a house on a street. A House has an int house number and an Point location. The key member function is draw, which draws the house at location. The draw function should also write the house number on the house using the message object. Next, design a class Street. An object of type Street stores two House objects called first and last and the number of houses, num_houses, on the street which is an int. Street also has a member function called plot. Plot should draw evenly spaced houses starting at first ending with last. The number of houses plotted is equal to number of houses on the street. Use these classes in a graphics program in which the user clicks with the mouse on the locations of the first and last house, then enters the house numbers of the first and last house, and the number of houses on the street. Then the entire street is plotted.
How to Create a C++ Graphics Application
This handout was originally written by Professor Wittman. Note that your version of Visual
studio might differ slightly from the one used in this handout. Any differences should be
Google unveils its Container Engine to run apps in the best possible way on its cloud flip.it/RPQLZ
Yahoo tops list of 10 most active tech acquirers in 2013 flip.it/g5c2f
Tresorit opens its end-to-end encrypted file-sharing service to the public flip.it/EK1IZ
In this problem, you will use C++ classes to implement the game of Flood It, a one player
game. You can play a graphical version of the game at http://floodit.appspot.com/.
An instance of Flood It consists of an nxn-grid of cells, each of which can be in one of 5
CS 225 Data Structures and Programming Principles
mp_parse—The Shunting Yard and ASTs
Write your own “circular array” class that provides efficient insert/remove operations at both the beginning and end of the sequence,
CSE 232
This is a singly-linked list (SLL) with a head and a tail. It differs from a standard SLL in that every insert places the new node into the list in sorted order. Thus, the SortedList is
This project also deals with the Dictionary abstract data type (ADT). The objectives of the project are to:
Program a binary search tree (BST) implementation of the Dictionary ADT.
Your task is to write a (very simple:-) student record system. You should be able to store details
about students - their name, subject and a student number; as well as the level they have most
recently completed ranging from 0 (meaning they are still in the first year) through to 3 (meaning
Your task is to write a program that plays a simplified version of the card game called
‘Blackjack’, or ‘Pontoon’ (or ’21’ and probably lots of other things as well).
Rules It turns out that there are lots of minor variations on the rules of this game – most of which
CS1002 Object-Oriented Programming Practical W11: Fox & Geese
Aims and Objectives
Your aim in this practical is to gain the following skill:
• to use 2-D arrays as a data structure in Java programs
The primary goal of this assignment is to practice thinking carefully about invariants, including
identifying invariants in existing code,
designing invariants for new code, and
writing new code with the invariants that you design.
CSC 210 Introduction to Programming with Java
The purpose of this project is to allow you to practice the use of selection and loops within your programs.
Sudoku Solver
Summary:
For this assignment you will be writing a program to solve Sudoku puzzles.
You are provided with a makefile, the “.h” files, and cell.cpp, and a master
solution named master_solver.
The United States Census Bureau estimates population changes since the most recent census
using data on births, deaths, and migration. The data for each county in the 50 states and the
District of Columbia during the period April 1, 2010 to July 1, 2013 are available at:
www.census.gov/popest/data/counties/totals/2013/files/CO-EST2013-Alldata.csv
Othello
Your goal for this assignment is to implement an Othello playing program that can beat you at Othello.
Your program should perform heuristic minimax.
Blackjack (sometimes called Twenty-One) is a popular card game at casinos. An introduction to
the rules of the game can be found at the United States Play Card Company’s website:
http://www.bicyclecards.com/card-games/rule/blackjack
In Blackjack, suits are not important. Each card is worth a certain number of points, and the goal
is to accumulate a point total which is higher than the dealer’s point total, without going over 21.
Most cards are worth the number of points printed on the card (for example, the Four of Clubs is
worth 4 points). However, Jacks, Queens and Kings are worth 10 points, and Aces are worth 1
point or 11 points (player’s choice).
代写Processing程序, 由于Processing题目很多是对艺术设计的考察,在这方面我并不擅长,但做一些简单的图形,动画或者小游戏还说可以的.
• You may implement a generative graphical, audio, or audio-visual sketch.
• Use randomness as a generator of unpredictability in your work.
• Your piece does not have to be interactive, although it may be.
• You should give your piece a title, don’t call it something as prosaic as
The primary goal of this assignment is to get more practice with Java, while working in the context of a simple object-oriented design. A secondary goal is to think carefully about tests and test coverage.
代写网络程序,聊天程序FTP, Http Proxy, P2P等,语言可以是Java C C++.
Chapter 13: Web Service Callbacks and Polling: the Chat Example The obvious next step we need to take is to rebuild the chat example that we used to illustrate sockets and rmi using web services. But there are problems...