A Graphical User Interfaces (GUI) is created with at least three kinds of objects in order to receive user input and process it. -components
(e.g., buttons, textfields) -listeners waits for events to occur -events (e.g., a button is pushed, a mouse is mov
/ Assignment #: / Name: / StudentID: / Lecture: / Description: / / /
The Assignment 6 class creates a Tabbed Pane with two tabs, one for Account creation and one for Account transfer. and adds it as its Applet content and also sets its size.
Arrays and ArrayLists
Arrays of objects
Suppose that we want to have an array of objects of the Student class: Student students = new Student; Before we use each object in this array, for each index, an object needs to be instantiated. as: students
/ / / / / / / / /
Assignment #: 11 Name: StudentID: Lecture: Description: The MazeSolver contains two 2-dimetional character arrays, one for the original and another to display the solution to the maze, and the size of maze. Its findSolution method solves
DecimalFormat and NumberFormat can be used to format output of numbers. They are defined in java.text package, thus this package needs to be imported at the top of the programs: import java.text.DecimalFormat; import jav
ArrayLists in JDK 5.0
Genericity (parameterized types)
Genericity is a mechanism for clients to specify the types of objects that a class can work with via parameters passed at declaration-time and evaluated at compile-time.
Suppose that you have the foll
/ Assignment #: / Name: / StudentID: / Lecture: / Description:
2 Quinton Candelaria 1201590498 MWF 2:00 This class. / use the Scanner class located in the
import java.util.Scanner; "java.util" directory
public class Assignment2 cfw_ public static void mai
/ Assignment #: / Name: / StudentID: / Lecture: / / Description: import import import i import
7 To To To it
be completed be completed be completed needs to be filled.
java.awt.*; javax.swing.*; java.awt.event.*; java.util.ArrayList;
public class WholePan
UML (Unified Modeling Language)
UML is used -to document the object-oriented development process -to design object-oriented programs UML diagrams are used to visualize relationship among classes and objects. Examples of UML diagrams Class diagrams, Object
/ Assignment #: / Name: / StudentID: / Lecture: / Description: import import import import import
6 your name your id your lecture it needs to be filled
java.awt.*; java.awt.event.*; javax.swing.*; javax.swing.event.*; java.util.*;
public class TransferPa
Split method of the String class
The split method of the String can be used to extract substrings from a string based on certain delimiters. In the split method, we can specify a string (regular expression) that acts as a delimiter and it returns a set of
A stack is a data structure in which access is only allowed from one end. Imagine the candy Pez dispensers
You insert and remove candy from the same end. The first piece in is the last piece out.
You have a stack of books - to get to the bottom,
(Stack class in java.util package, it extends Vector class)
A stack adds items only to the top of the list and removes them from the top. It is called a LIFO (Last-In, First-Out) data structure. Stacks are often drawn vertically. Some operations in
Tokenization using the Scanner class
We can extract substrings of a string using the Scanner class as well. useDelimiter method can specify the string pattern (including one character - delimiter). See the following example: import java.util.Scanner; publ
The String class
In Java, a string is an object of the String class defined in java.lang package. A string can be instantiated as follows: String string1 = new String("this is a string"); Or String string1 = "this is a string"; The complete list of method
We suppose that you have seen iterative methods in the prerequisite courses. Methods using a loop such as for loops, while loops, or do-while loops are considered to be iterative. Often we can compute the same result using recursion (without usi
First Name (Print)_ Last Name _ Lecture _ For each of the following problems write a recursive method. 1. Write a recursive method int power(int i, int j) which determines the result of ij where j >= 0. public int powerR(int i,
Quick Sort algorithm The quick sort uses the strategy of divide and conquer like merge sort. Its idea is to rearrange the element in the range so that no element in the first sub-array is larger than any element in the last sub-array. i.e., all elements i
A queue is a data structure of ordered items where items are added to the rear (in the order that they are entered and removed from the front.)
Remember in Class - we lined people up into a queue and the first person in line received their project
/ / / / / /
Assignment #: 11 Name: Your name StudentID: your id Lecture: your lecture Description: The position class pairs a row number and a column number, and also keeps track which direction it is going next (face value).
public class Position cfw_ pr
Network and World Wide Web, bytecode
A network is two or more computers that are connected so that data and resources can be shared.
Point to Point connection
-Each computer in a network could be directly connected to every other computer in the network -
Mouse Listener and Mouse Motion Listener - defined in java.awt.event package.
If we want to obtain a user input through a mouse, we need to create an object of a listener class that implements MouseListener interface or MouseMotionListener interface. To d
Static vs. Dynamic Structures
-A static data structure has a fixed size example: arrays (Note, this meaning is different from those associated with static modifier) -A dynamic data structure grows and shrinks as required by the information
/ / / /
A linked list is a sequence of nodes with efficient element insertion and removal. This class contains a subset of the methods of the standard java.util.LinkedList class.
import java.util.NoSuchElementException; public class LinkedList cfw_ /neste
An algorithm is a sequence of computational steps that transform some input into some output. It is a tool for solving a well-defined computational problem. Examples of such problems - searching, sorting
Searching Linear Search Algorithm
Java identifiers (e.g., variable names)
Java identifiers consist of letters, digit, under score _ , and dollar sign $. They cannot begin with a digit.
Java API (Application Programmer Interfaces) Specification
- It contains the list of all pre-defined Jav
/ / / / / / /
Assignment #: 4 Name: Your name StudentID: Lecture: 1 Description: Assignment 4 class displays a menu of choices to a user and performs the chosen task. It will keep asking a user to enter the next choice until the choice of 'Q' (Quit) is en
/ Assignment #:
/ Arizona State
University - CSE205
This class reads an integer from a keyboard and prints it out
along with other messages.
/ Assignment #: 5
/ Arizona State University - CSE205
Lecture: MWF 10:40am
/ Description: The Assignment 5 class displa ys a menu of choices
(add cylinder soup, box soup,search soup,
list soups, quit, display m
/ Assignment #:
/ Arizona State
University - CSE205
/1. PUBLIC - Software engineers shall act consistently with the public
/ -A software engineer would like to desi