Lab Assignment 17 - Working with Object Arrays
In the old days we would do these projects as applets. Unfortunately, applets are not as secure as
Sun / Oracle once thought they were. Now, it is almost impossible to run an applet over the web.
If you want to see how the Tic-Tac-Toe game looks you will have to view this video
In this homework, you\'ll build your own version of TicTacToe using JLabels, GridLayout, and a
couple arrays. Before you get started, however, why don\'t you take a minute to play a game?
Declare a two-dimensional array of primitive values
Declare a two-dimensional array of object references
Initialize each of the elements in a two-dimensional array of object references
Use a pair of nested for loops to process the elements in a two-dimensional array
Create a class called TicTacToe. Place it in a file called TicTacToe.java
Have your class extend from JFrame
Have your class implement ActionListener and MouseListener.
Create all of the methods needed for the ActionListener and MouseListener interfaces.
Make sure to import javax.swing.*, java.awt.* and java.awt.event.*
Before ddefining your attributes you need to create a container called content and initialize it by
sending the getContentPane() message to this.
Define your application\'s attributes. The TicTacToe program has three different kinds of fields
that you must define before you can compile the program successfully. Make sure you define
your fields and check for errors before you attempt to go further.
Here are the three kinds of fields:
1. Program Arrays
The TicTacToe program has two \"parallel\", 3 x 3, two dimensional arrays. Start your
programming by defining these two arrays:
The first of these is an array of JLabel objects. This array, named grid, is used to display the
actual Xs and Os on your screen. Each JLabel will display an X, and O, or a blank.
The second array is an array of char primitives. This array, named game, is used to simplify
keeping score as the game is played. Each element in game contains a space \' \' if the position
has yet to be played, an \'X\', if the position contains an X, and an \'O\' if the position contains an
O.
2. Graphical User-interface Fields
In addition to the JLabels that make up the array named grid, the TicTacToe application contains
the following user-interface elements. Define these elements after you\'ve finished defining your
arrays:
A JButton object named restart. The user can restart the game by clicking this Button.
A JPanel named p. Use the default constructor to create p; it will hold the JLabels in grid
A JLabel named status. This will keep the user informed of the game\'s progress. You might
want to initialize status to a helpful welcome message.
3. Primitive Fields
Your program will contain the following primitive fields which you\'ll use as you play the game:
An int named numClicks that will keep track of how many X\'s and O\'s are displayed.
A boolean named isDone which is used to determine when the game is .
N Queen Problem using Branch And Bound - GeeksforGeeks.pdfakashreddy966699
The document discusses the N queens puzzle and its solution using the branch and bound algorithm. The N queens puzzle aims to place N chess queens on an N×N chessboard so that no two queens threaten each other. The branch and bound solution avoids exploring paths that cannot lead to a valid solution. Pseudocode and implementations in C++ and Java are provided to demonstrate solving the N queens puzzle using branch and bound.
Read carefully and follow exactly Java You are to write a Breakou.pdfrupeshmehta151
Read carefully and follow exactly Java:
You are to write a Breakout game, using Java applets for animation. The requirements for this
program are designed so that you will also use an ArrayList, Generics, an abstract class,
polymorphism, and file I/O. Please read the following instructions very carefully, as they attempt
to explain how the various parts of the animation work; then you can update the applet, using
your knowledge of ArrayLists, Generics, abstract classes, and polymorphism.
Existing classes: There are a number of existing classes that are already written and ready for
use. They are contained in the file Breakout.java (they are not defined as public so they don’t
have to be in a file that matches their name). Please look them over carefully to see what
functionality is available. The classes (implemented inside Breakout.java) are:
Ball: this is defined as a subclass of Rectangle (even though that is geometrically invalid!). The
reason for this is so Ball can inherit data for its x coordinate, y coordinate, width, and height. It
also adds some data of its own (see the code) and methods (among others) to:
bounceLeftRight() (which changes the angle at which it moves after bouncing off a left or right
side),
bounceTopBottom() (which changes the angle at which it moves after bouncing off a top or
bottom)
move() (change its coordinates),
freeze()/unfreeze() itself,
It also inherits important methods from the Rectangle class
translate – changes its x and y coordinates respectively by the 2 numbers that are passed in
intersects(Rectangle other) – returns true if it intersects another Rectangle
intersection(Rectangle other) – returns the Rectangle that is the intersection
Paddle: this is also defined as a subclass of Rectangle so it inherits the same data/methods that
are described above for the Ball class. The fact that Ball and Rectangle are both Rectangles
means that code can ask a Ball if it intersects a Paddle, so it can easily tell when to make things
happen.
Wall: this is not in its own file, but rather in the Breakout.java file. Wall is also a subclass of
Rectangle to it is easy to determine if the ball has collided a wall.
The Breakout class (which is an Applet): if you look at the code for the Breakout class, you will
notice it has a number of things:
It is a subclass of Applet, so it inherits data and methods as well as the ability to function as an
Applet. For example, if you want to know the height of the applet you can ask it through the
this.getHeight(); method.
It implements the KeyListener interface, which gives it the ability to “listen” for keystrokes
from the keyboard. If you were to look up the KeyListener interface in the documentation, you
would find that anything that implements it must have the KeyPressed, KeyReleased, and
KeyTyped methods. These are all there; KeyPressed and KeyReleased set/unset Boolean flags
which remember that the left or right arrow keys are or are not being pressed.
It has a method called in.
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
This document provides documentation on creating a 2D game engine in Ring. It discusses organizing the project into layers, including the games layer, game engine classes layer, and interface to graphics library layer. It then describes the key classes in the game engine - Game, GameObject, Sprite, Text, Animate, Sound, and Map. It provides details on the attributes and methods for each class. It also provides an example of how to load the game engine library, create a Game object, and start drawing text to the screen. The document is intended to teach how to structure a 2D game engine project using different programming paradigms in Ring.
The Ring programming language version 1.5.3 book - Part 58 of 184Mahmoud Samir Fayed
This document provides an overview of how to build a 2D game engine in Ring using different programming paradigms. It discusses using declarative programming for the game layer, object-oriented programming for game engine classes, and procedural programming for the graphics library interface. The document outlines the layers of the engine including graphics library bindings, the interface layer, game engine classes, and the games layer. It provides details on key classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map that can be used to build games. Examples are given for creating a game window and drawing/animating text to demonstrate using the engine.
The document discusses various concepts in Visual Basic such as extracting and drawing images using image list controls, inheritance, the Exit Try statement, SQL select statements, record navigation in datasets, and jagged arrays.
It provides examples to explain each concept. For image list controls, it shows how to extract individual images and assign them to other controls, as well as how to draw images. For inheritance, it discusses the "is a" relationship between classes. The Exit Try statement example breaks out of a Try/Catch block. SQL select statements are demonstrated by selecting all records or specific columns. Record navigation in a dataset involves moving between records using previous/next buttons or going to the first/last record. Finally, jagged arrays
The Ring programming language version 1.3 book - Part 38 of 88Mahmoud Samir Fayed
This document describes a game engine project built in Ring for creating 2D games. It discusses the different layers of the project, including the games layer, game engine classes layer, interface to graphics libraries layer, and graphics library bindings layer. It provides details on the RingAllegro and RingLibSDL libraries used for graphics. It outlines the main game engine classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It gives examples of how to use the engine to create a game window, draw text, and move text. The goal of the project is to allow games to be built with Ring using different programming paradigms like declarative programming for games and object-oriented programming for the engine classes
Hi there I am having difficulty in finalizing my Tetris game , below.pdffonecomp
The document provides instructions for completing an assignment to add additional pieces and rotation functionality to an existing Tetris game coded in Java. It describes refactoring the code into a superclass and subclasses for each piece type. It then details how to initialize and add code for the remaining 6 piece types. It also explains how to implement rotation by checking if moves are valid and using dynamic dispatch. The student is asked to test each new piece individually, follow object-oriented design principles, and write a report discussing their process.
This document discusses arrays and their uses. Arrays allow programs to efficiently organize and access similar data. The document introduces one-dimensional arrays, using an array to track figure skating scores as an example. It explains how to declare and initialize arrays, access elements using indexes, and iterate over arrays using for loops. The document also discusses using arrays to collect input data, such as tallying votes in an election, and representing translation tables.
N Queen Problem using Branch And Bound - GeeksforGeeks.pdfakashreddy966699
The document discusses the N queens puzzle and its solution using the branch and bound algorithm. The N queens puzzle aims to place N chess queens on an N×N chessboard so that no two queens threaten each other. The branch and bound solution avoids exploring paths that cannot lead to a valid solution. Pseudocode and implementations in C++ and Java are provided to demonstrate solving the N queens puzzle using branch and bound.
Read carefully and follow exactly Java You are to write a Breakou.pdfrupeshmehta151
Read carefully and follow exactly Java:
You are to write a Breakout game, using Java applets for animation. The requirements for this
program are designed so that you will also use an ArrayList, Generics, an abstract class,
polymorphism, and file I/O. Please read the following instructions very carefully, as they attempt
to explain how the various parts of the animation work; then you can update the applet, using
your knowledge of ArrayLists, Generics, abstract classes, and polymorphism.
Existing classes: There are a number of existing classes that are already written and ready for
use. They are contained in the file Breakout.java (they are not defined as public so they don’t
have to be in a file that matches their name). Please look them over carefully to see what
functionality is available. The classes (implemented inside Breakout.java) are:
Ball: this is defined as a subclass of Rectangle (even though that is geometrically invalid!). The
reason for this is so Ball can inherit data for its x coordinate, y coordinate, width, and height. It
also adds some data of its own (see the code) and methods (among others) to:
bounceLeftRight() (which changes the angle at which it moves after bouncing off a left or right
side),
bounceTopBottom() (which changes the angle at which it moves after bouncing off a top or
bottom)
move() (change its coordinates),
freeze()/unfreeze() itself,
It also inherits important methods from the Rectangle class
translate – changes its x and y coordinates respectively by the 2 numbers that are passed in
intersects(Rectangle other) – returns true if it intersects another Rectangle
intersection(Rectangle other) – returns the Rectangle that is the intersection
Paddle: this is also defined as a subclass of Rectangle so it inherits the same data/methods that
are described above for the Ball class. The fact that Ball and Rectangle are both Rectangles
means that code can ask a Ball if it intersects a Paddle, so it can easily tell when to make things
happen.
Wall: this is not in its own file, but rather in the Breakout.java file. Wall is also a subclass of
Rectangle to it is easy to determine if the ball has collided a wall.
The Breakout class (which is an Applet): if you look at the code for the Breakout class, you will
notice it has a number of things:
It is a subclass of Applet, so it inherits data and methods as well as the ability to function as an
Applet. For example, if you want to know the height of the applet you can ask it through the
this.getHeight(); method.
It implements the KeyListener interface, which gives it the ability to “listen” for keystrokes
from the keyboard. If you were to look up the KeyListener interface in the documentation, you
would find that anything that implements it must have the KeyPressed, KeyReleased, and
KeyTyped methods. These are all there; KeyPressed and KeyReleased set/unset Boolean flags
which remember that the left or right arrow keys are or are not being pressed.
It has a method called in.
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
This document provides documentation on creating a 2D game engine in Ring. It discusses organizing the project into layers, including the games layer, game engine classes layer, and interface to graphics library layer. It then describes the key classes in the game engine - Game, GameObject, Sprite, Text, Animate, Sound, and Map. It provides details on the attributes and methods for each class. It also provides an example of how to load the game engine library, create a Game object, and start drawing text to the screen. The document is intended to teach how to structure a 2D game engine project using different programming paradigms in Ring.
The Ring programming language version 1.5.3 book - Part 58 of 184Mahmoud Samir Fayed
This document provides an overview of how to build a 2D game engine in Ring using different programming paradigms. It discusses using declarative programming for the game layer, object-oriented programming for game engine classes, and procedural programming for the graphics library interface. The document outlines the layers of the engine including graphics library bindings, the interface layer, game engine classes, and the games layer. It provides details on key classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map that can be used to build games. Examples are given for creating a game window and drawing/animating text to demonstrate using the engine.
The document discusses various concepts in Visual Basic such as extracting and drawing images using image list controls, inheritance, the Exit Try statement, SQL select statements, record navigation in datasets, and jagged arrays.
It provides examples to explain each concept. For image list controls, it shows how to extract individual images and assign them to other controls, as well as how to draw images. For inheritance, it discusses the "is a" relationship between classes. The Exit Try statement example breaks out of a Try/Catch block. SQL select statements are demonstrated by selecting all records or specific columns. Record navigation in a dataset involves moving between records using previous/next buttons or going to the first/last record. Finally, jagged arrays
The Ring programming language version 1.3 book - Part 38 of 88Mahmoud Samir Fayed
This document describes a game engine project built in Ring for creating 2D games. It discusses the different layers of the project, including the games layer, game engine classes layer, interface to graphics libraries layer, and graphics library bindings layer. It provides details on the RingAllegro and RingLibSDL libraries used for graphics. It outlines the main game engine classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It gives examples of how to use the engine to create a game window, draw text, and move text. The goal of the project is to allow games to be built with Ring using different programming paradigms like declarative programming for games and object-oriented programming for the engine classes
Hi there I am having difficulty in finalizing my Tetris game , below.pdffonecomp
The document provides instructions for completing an assignment to add additional pieces and rotation functionality to an existing Tetris game coded in Java. It describes refactoring the code into a superclass and subclasses for each piece type. It then details how to initialize and add code for the remaining 6 piece types. It also explains how to implement rotation by checking if moves are valid and using dynamic dispatch. The student is asked to test each new piece individually, follow object-oriented design principles, and write a report discussing their process.
This document discusses arrays and their uses. Arrays allow programs to efficiently organize and access similar data. The document introduces one-dimensional arrays, using an array to track figure skating scores as an example. It explains how to declare and initialize arrays, access elements using indexes, and iterate over arrays using for loops. The document also discusses using arrays to collect input data, such as tallying votes in an election, and representing translation tables.
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdffms12345
EX 25-15 Decision on accepting additional business Brightstone Tire and Rubber Company has
capacity to produce 170,000 tires. Brightstone presently produces and sells 130,000 tires for the
North American market at a price of $175 per tire. Brightstone is evaluating a special order from
a European automobile com- pany, Euro Motors. Euro is offering to buy 20,000 tires for $116
per tire. Brightstone\'s accounting system indicates that the total cost per tire is as follows: OBJ.
1 $ 56 Direct materials Direct labor Factory overhead (60% variable) Selling and administrative
expenses (45% variable) Total 25 26 $129 Brightstone pays a selling commission equal to 5% of
the selling price on North Ameri- can orders, which is included in the variable portion of the
selling and administrative expenses. However, this special order would not have a sales
commission. If the order was accepted, the tires would be shipped overseas for an additional
shipping cost of $7.50 per tire. In addition, Euro has made the order conditional on receiving
European safety certification. Brightstone estimates that this certification would cost $165,000.
a. Prepare a differential analysis dated January 21 on whether to reject (Alternative 1) or accept
(Alternative 2) the special order from Euro Motors. b. What is the minimum price per unit that
would be financially acceptable to Brightstone?
Solution
1.
2.Differential AnalysisReject Order (Alt. 1) or Accept Order (Alt.2)January 21Reject
OrderAccept OrderDifferential Effect on Income(Alternative 1)(Alternative 2)(Alternative
2)Revenues 22,750,000 25,070,000
2,320,000(130000*175)(130000*175)+(20000*116)CostsDirect Materials
7,280,000 8,400,000 1,120,000(130000*56)(150000*56)Direct
Labor 2,860,000 3,300,000
440,000(130000*22)(150000*22)Variable Factory Overhead 1,950,000
2,250,000 300,000(60% of
25)(130000*60%*25)(150000*60%*25)Variable Selling and Admin Expenses15210001580000
59,000(45% of 26)(130000*45%*26)(130000*45%*26)+(20000*2.95Shipping cost
- 150,000
150,000(20000*7.5)Certification cost -
165,000 165,000Income (Loss) 9,139,000
9,225,000 86,000Bright stone should accept the special order from Euro Motors.
C++ STL (quickest way to learn, even for absolute beginners).pptxGauravPandey43518
C++ STL is a collection of containers and algorithms that provide common programming tasks. It includes data structures like vector, set, map as well as sorting and searching algorithms. Using STL containers makes code shorter, faster and more error-free compared to manually writing these routines. STL is important for learning advanced C++ concepts like graphs and algorithms.
The Ring programming language version 1.9 book - Part 58 of 210Mahmoud Samir Fayed
This document discusses using different programming paradigms together in a game engine project. It describes layers for games, the game engine classes, and the interface to graphics libraries. The layers are: games (declarative), game engine classes (object-oriented), interface to graphics library (procedural), and graphics library bindings. The document provides details on classes for the game engine like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It also gives examples of how to use the engine by creating a game window and drawing/moving text.
Visual programming (VP) refers to a method of programming that uses a graphical interface to create and modify code, rather than typing out code manually. Unlike traditional text-based programming, visual programming uses visual elements to represent code. Some graphical elements you can use when creating programs with VP include:
The document provides instructions for setting up a basic match-3 puzzle game grid in Construct 2. Key steps include:
1. Setting up the project with different layers for the background, blocks, and game field. Tiled backgrounds and sprites are added to create the game board visuals.
2. Defining global variables for block spawn positions and adding an instance variable to track each block's color.
3. Using nested for loops to spawn a 8x8 grid of blocks at random colors when the layout starts. Each block is assigned a random color value from 1-6.
4. Adding an event to set each block's frame based on its color value, displaying the correct image. This
I have another assignment due for an advance java programming class .pdfFORTUNE2505
I have another assignment due for an advance java programming class that I do not understand
how to do. I don\'t know how to implement the comparable interface and sort the cards from
lowest to highest based on suit within rank. And I also dont understand how I am suppose to add
a static nested class that implements the comparator interface and then sort the cards lowest to
highest based on rank within a suit. Then I have to add the different buttons and I am not sure
which class that these buttons are to be placed in. The buttons I have to add are: Deal Button,
Fish Sort Button, Spades Sort Button, and a Reverse Toggle Button. The description for each
button is in the instructions below:
Program 4 – Sorting with nested classes and lambda expressions
This program is a bit different from our others. Just like the last program, you will start with the
project that is attached to this assignment. Remember to rename the project. You will lose points
if you do not. Also, remember that you need to submit an Eclipse project, not just Java files. You
will lose points there as well.
The main point of the exercise is to demonstrate your ability to use various types of nested
classes. Of course, sorting is important as well, but you don’t really need to do much more than
create the class that does the comparison. In general, I like giving you some latitude in how you
design and implement your projects. However, for this assignment, each piece is very specific as
to how I want you to implement things. There are a number of parts to this program. Make
certain you accomplish the two additions to the Card class early-on since much of the rest of
your program will depend on that work.
The requirements:
Properly named project, good code (avoid redundancy), nice UI, etc. (20 pts)
Implement the Comparable interface in the Card class. (15 pts)
Sort the cards lowest to highest based on suit within rank, e.g.
2 clubs
2 diamonds
2 hearts
2 spades
3 clubs
3 diamonds
etc.
Add a static nested class to the Card class that implements the Comparator interface. (15 pts)
Sort the cards lowest to highest based on rank within suit, e.g.
2 clubs
3 clubs
4 clubs
5 clubs
etc.
In the UI, add the following to your interface.
Deal Button (10 pts)
Implement the Deal action handler using an inner class (not local). You may want to pull some
of the code from the show method that is already there. Or better, put the common code into a
class and call it.
Fish Sort Button (15 pts)
Sort the code in a way that would be useful playing Go Fish. I.e. with all of the cards grouped
together. Implement the action handler using a lambda expression in the UI. The code in the
lambda expression should depend on the Card class for the actual sorting (i.e. the natural order).
It must not call any other method in the UI class.
Spades Sort Button (15 pts)
Order the cards in such a way that they would be useful playing Spades; i.e. with the cards sorted
by rank within suit and the suits in the order pro.
This document provides an introduction to using MATLAB for numerical computations and graphical output. It describes how to launch MATLAB, perform basic arithmetic operations and matrix calculations, use loops to iterate calculations, and generate different types of plots and graphs including sine waves, bar graphs, and subplots. The exercises walk through examples of these MATLAB functions and commands to familiarize users with its interface and capabilities.
The Ring programming language version 1.2 book - Part 36 of 84Mahmoud Samir Fayed
The document describes a game engine for 2D games created using Ring. It has the following layers:
1) Games layer uses declarative programming to create games.
2) Game engine classes layer uses object-oriented programming for classes like Game, Sprite, etc.
3) Interface layer hides differences between graphics libraries (Allegro, SDL) for a consistent API.
4) Graphics library bindings generate C code from configuration files to interface with Allegro and SDL.
The engine provides classes for games, objects, sprites, text, animation and sound. Examples show creating a game window, drawing text, playing sounds, and animating sprites. The engine handles input and updating the game loop.
This document provides useful Excel macros and functions. It includes macros for deleting blank columns, uploading rows over 65,536, and removing unnecessary columns. Formulas are presented for finding matching values in two columns, and showing distinct values in a column.
(download for flawless quality) State Monad - Learn how it works - Follow Alvin Alexander’s example-driven build up to the State Monad and then branch off into a detailed look at its inner workings.
Hey i have attached the required file for my assignment.and addisorayan5ywschuit
Hey i have attached the required file for my assignment.
and additionally i have also mentioned the points of assignments below.
this one is based on this concept.
Lab 4 (Collection Framework, Exception,
IO Handling, Generic method and GUI Programming)
NOTE: You should properly format your source code files for better readability and write
appropriate comments in the code.
Exercise
1
[10
points]:
Write a program that asks a user for a file name and prints the number of characters, words (separated by whitespace), and lines in that file. Then, it prints the frequency of each word (case insensitive) containing in the file (Test1.txt); Your program should handle exceptions related to file opening and reading from the file.
This is a test this
Hi there hi hi hi
Output at the console:
Number of characters: 35
Number of words: 10
Number of lines: 2
Data written to the file (Test1.txt):
this 2
is 1
a 1
test 1
hi 4
there 1
Hint: you may use a HashMap to store and count the frequency of the words in the file.
Exercise
2
[20
points]:
Your task is to write a program that uses a textfile containing any number of lines of double values as input. Each line in the file is supposed to have no more than 15 values on it. If the file exists and each line in the file does in fact contain 15 or fewer double values, then the program processes and reports on each line in turn by displaying its line number, the number of values on that line, and the range of values on the line.
But, as you know, things are not always as they seem, or as they are supposed to be. For example, the file your program is looking for may not be there, there may be no double values at all on some lines, some lines may contain more values than the allowed maximum of 15, and some lines may contain "values" that aren't even doubles (i.e., badly formatted "invalid" double values). The program must recognize and respond appropriately to each of these problems.
Note:
You must implement exception handling. Not only am
I
requiring it, but Java itself will also require it since you will have to use Java resources that force you to deal with the IOException. In addition to this exception, you are also required to handle the ArrayIndexOutOfBounds and the NumberFormatException at appropriate points in your program.
This program reads in, from the command line, the name of a textfile containing any number of lines of doubles and then processes each line in turn. Processing a line means computing and then reporting, for that line, its line number, along with the range of values on the line.
The program can recognize a number of problems that may occur when trying to process such a file. First, the file itself may not be present. If so, the following message is displayed (the first line comes from the system, the second from the program itself):
filename.ext (The system cannot find the file specified) Program will now terminate. ...
VISUAL BASIC 6 - CONTROLS AND DECLARATIONSSuraj Kumar
1. The document discusses various data types and controls available in VB.NET including textboxes, labels, combo boxes, list boxes, checkboxes and option buttons.
2. It describes how to declare and initialize variables of different data types like strings, integers, and doubles. Arrays can be single or multi-dimensional.
3. The various controls are described including their properties and common events. Methods like AddItem and RemoveItem are discussed for dynamically populating combo boxes and list boxes.
This document provides an overview of panels and layout in WPF. It discusses the built-in panels like Canvas, StackPanel, WrapPanel, DockPanel and Grid. It also covers layout properties, transforms, creating custom panels, and the two phase layout process of measure and arrange.
For more course tutorials visit
www.tutorialrank.com
Week 1 HomeworkCommand Line in Windows and Linux
• Using Google, research what kernel operating systems have been used in the video gaming industry. Describe the architecture and details regarding its advantages or disadvantages (i.e, consider Windows, Linux, based, etc.). A minimum of two paragraphs of research information is required, along with your own interpretation of the content.
• Using Google, research the use of parallelism and concurrency in video gaming today. Describe how each
For more course tutorials visit
www.tutorialrank.com
Week 1 HomeworkCommand Line in Windows and Linux
• Using Google, research what kernel operating systems have been used in the video gaming industry. Describe the architecture and details regarding its advantages or disadvantages (i.e, consider Windows,
This document outlines the tasks for Part 1 of a project on object-oriented programming. Students are asked to implement missing methods in the Coordinate and TTTBoard classes to support playing Tic Tac Toe on various board sizes. They should then test the graphical and command line interfaces, documenting the results. Optional challenge tasks involve implementing the games Connect Four and Go. Deliverables include a project report with specified sections due by December 6th.
This programming assignment involves implementing an AI for a sliding tile puzzle game using the A* search algorithm. Students will create classes to represent the game board, potential moves, heuristics, and a solver. The solver will use A* to find the shortest sequence of moves to solve the puzzle by maintaining open and closed lists of potential moves. The main program will allow a user to play the game and request the optimal solution from the solver.
This document discusses structured programming and arrays. It begins by introducing arrays as a way to store multiple values in a structured manner using indices, rather than individual variables. It then discusses how to input and output values from arrays using loops. It also covers multidimensional arrays and declaring arrays. The document provides examples of using arrays to store and manipulate data, such as finding averages and min/max values. It concludes by introducing bubble sort as a way to sort arrays into order.
in C++ , Design a linked list class named IntegerList to hold a seri.pdfeyewaregallery
in C++ , Design a linked list class named IntegerList to hold a series of integers. The class must
have public member functions for appending , inserting, deleting and displaying nodes. The
append function must append a node to the end of the list. The insert function must insert node in
ascending order. The delete function must delete the node with the given value. The display
function should display the list from head to tail. The IntegerList class should also have a
destructor that destroys the list and release memory. The list node must be declared as a structure
using keyword struct. This structure is a private member of IntegerList. You should also store the
head of the list as a private member.
Write a test program to test the implementation your IntegerList class works properly.
Solution
Here is the code for the above scenario:
#include
using namespace std;
struct ListNode
{
float value;
ListNode *next;
};
ListNode *head;
class LinkedList
{
public:
int insertNode(float num);
int appendNode(float num);
void deleteNode(float num);
void destroyList();
void displayList();
LinkedList(void) {head = NULL;}
~LinkedList(void) {destroyList();}
};
int LinkedList::appendNode(float num)
{
ListNode *newNode, *nodePtr = head;
newNode = new ListNode;
if(newNode == NULL)
{
cout << \"Error allocating memory for new list member!\ \";
return 1;
}
newNode->value = num;
newNode->next = NULL;
if(head == NULL)
{
cout << \"List was empty - \" << newNode->value;
cout << \" is part of list\'s first node.\ \";
head = newNode;
}
else
{
while(nodePtr->next != NULL)
nodePtr = nodePtr->next;
nodePtr->next = newNode;
}
return 0;
}
int LinkedList::insertNode(float num)
{
struct ListNode *newNode, *nodePtr = head, *prevNodePtr = NULL;
newNode = new ListNode;
if(newNode == NULL)
{
cout << \"Error allocating memory for new list member!\ \";
return 1;
}
newNode->value = num;
newNode->next = NULL;
if(head==NULL) {
cout << \"List was empty - \" << newNode->value;
cout << \" is part of list\'s first node.\ \";
head = newNode;
}
else
{
while((nodePtr != NULL) && (nodePtr->value < num)) {
prevNodePtr = nodePtr;
nodePtr = nodePtr->next;
}
if(prevNodePtr==NULL)
newNode->next = head;
else
newNode->next = nodePtr; prevNodePtr->next = newNode;
}
return 0;
}
void LinkedList::deleteNode(float num)
{
struct ListNode *nodePtr = head, *prevNodePtr = NULL;
if(head==NULL) {
cout << \"The list was empty!\ \";
return;
}
if(head->value == num) {
head = nodePtr->next;
delete [] nodePtr;
}
else
{
while((nodePtr!= NULL)&&(nodePtr->value != num)) {
prevNodePtr = nodePtr;
nodePtr = nodePtr->next;
}
if(nodePtr==NULL)
cout << \"The value \" << num << \" is not in this list!\ \";
else {
prevNodePtr->next = nodePtr->next;
delete [] nodePtr;
}
}
}
void LinkedList::destroyList()
{
struct ListNode *nodePtr = head, *nextNode = nodePtr;
if(head==NULL) {
cout << \"The list is empty!\ \";
return;
}
while (nodePtr != NULL) {
nextNode = nodePtr->next;
delete [] nodePtr;
nodePtr = nextNode;
}
}
void LinkedList.
In addition to the fossil record, what other kinds of evidence reinfo.pdfeyewaregallery
In addition to the fossil record, what other kinds of evidence reinforce the evolutionary of life?
You may want to use your textbook as a reference.
Solution
In addition to fossil record, application of Molecular Systematics is very much helpful for easy
identification of fossilized organism. Molecular systematics involves comparisons of nucleic
acids or other molecules to presume the degree of relatedness which can disclose phylogenetic
relationships which usually cannot be determined by non-molecular methods like comparative
anatomy. For example, molecular systematics helps us to uncover evolutionary relationships
between groups and allow us to reconstruct phylogenic trees among groups of present-day
organisms for which the fossil record is poor or lacking entirely. For example, the DNA that
encodes for ribosomal RNA (rRNA) changes comparatively slowly. Therefore, comparisons of
DNA sequences in these genes are valuable for investigating relationships between taxa that
diverged hundreds of millions of years ago. Other molecular methods useful for determining
phylogeny from fossil record include Nucleic acid sequencing, Genomic fingerprinting (RFLP)
and Amino acid sequencing..
More Related Content
Similar to Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdffms12345
EX 25-15 Decision on accepting additional business Brightstone Tire and Rubber Company has
capacity to produce 170,000 tires. Brightstone presently produces and sells 130,000 tires for the
North American market at a price of $175 per tire. Brightstone is evaluating a special order from
a European automobile com- pany, Euro Motors. Euro is offering to buy 20,000 tires for $116
per tire. Brightstone\'s accounting system indicates that the total cost per tire is as follows: OBJ.
1 $ 56 Direct materials Direct labor Factory overhead (60% variable) Selling and administrative
expenses (45% variable) Total 25 26 $129 Brightstone pays a selling commission equal to 5% of
the selling price on North Ameri- can orders, which is included in the variable portion of the
selling and administrative expenses. However, this special order would not have a sales
commission. If the order was accepted, the tires would be shipped overseas for an additional
shipping cost of $7.50 per tire. In addition, Euro has made the order conditional on receiving
European safety certification. Brightstone estimates that this certification would cost $165,000.
a. Prepare a differential analysis dated January 21 on whether to reject (Alternative 1) or accept
(Alternative 2) the special order from Euro Motors. b. What is the minimum price per unit that
would be financially acceptable to Brightstone?
Solution
1.
2.Differential AnalysisReject Order (Alt. 1) or Accept Order (Alt.2)January 21Reject
OrderAccept OrderDifferential Effect on Income(Alternative 1)(Alternative 2)(Alternative
2)Revenues 22,750,000 25,070,000
2,320,000(130000*175)(130000*175)+(20000*116)CostsDirect Materials
7,280,000 8,400,000 1,120,000(130000*56)(150000*56)Direct
Labor 2,860,000 3,300,000
440,000(130000*22)(150000*22)Variable Factory Overhead 1,950,000
2,250,000 300,000(60% of
25)(130000*60%*25)(150000*60%*25)Variable Selling and Admin Expenses15210001580000
59,000(45% of 26)(130000*45%*26)(130000*45%*26)+(20000*2.95Shipping cost
- 150,000
150,000(20000*7.5)Certification cost -
165,000 165,000Income (Loss) 9,139,000
9,225,000 86,000Bright stone should accept the special order from Euro Motors.
C++ STL (quickest way to learn, even for absolute beginners).pptxGauravPandey43518
C++ STL is a collection of containers and algorithms that provide common programming tasks. It includes data structures like vector, set, map as well as sorting and searching algorithms. Using STL containers makes code shorter, faster and more error-free compared to manually writing these routines. STL is important for learning advanced C++ concepts like graphs and algorithms.
The Ring programming language version 1.9 book - Part 58 of 210Mahmoud Samir Fayed
This document discusses using different programming paradigms together in a game engine project. It describes layers for games, the game engine classes, and the interface to graphics libraries. The layers are: games (declarative), game engine classes (object-oriented), interface to graphics library (procedural), and graphics library bindings. The document provides details on classes for the game engine like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It also gives examples of how to use the engine by creating a game window and drawing/moving text.
Visual programming (VP) refers to a method of programming that uses a graphical interface to create and modify code, rather than typing out code manually. Unlike traditional text-based programming, visual programming uses visual elements to represent code. Some graphical elements you can use when creating programs with VP include:
The document provides instructions for setting up a basic match-3 puzzle game grid in Construct 2. Key steps include:
1. Setting up the project with different layers for the background, blocks, and game field. Tiled backgrounds and sprites are added to create the game board visuals.
2. Defining global variables for block spawn positions and adding an instance variable to track each block's color.
3. Using nested for loops to spawn a 8x8 grid of blocks at random colors when the layout starts. Each block is assigned a random color value from 1-6.
4. Adding an event to set each block's frame based on its color value, displaying the correct image. This
I have another assignment due for an advance java programming class .pdfFORTUNE2505
I have another assignment due for an advance java programming class that I do not understand
how to do. I don\'t know how to implement the comparable interface and sort the cards from
lowest to highest based on suit within rank. And I also dont understand how I am suppose to add
a static nested class that implements the comparator interface and then sort the cards lowest to
highest based on rank within a suit. Then I have to add the different buttons and I am not sure
which class that these buttons are to be placed in. The buttons I have to add are: Deal Button,
Fish Sort Button, Spades Sort Button, and a Reverse Toggle Button. The description for each
button is in the instructions below:
Program 4 – Sorting with nested classes and lambda expressions
This program is a bit different from our others. Just like the last program, you will start with the
project that is attached to this assignment. Remember to rename the project. You will lose points
if you do not. Also, remember that you need to submit an Eclipse project, not just Java files. You
will lose points there as well.
The main point of the exercise is to demonstrate your ability to use various types of nested
classes. Of course, sorting is important as well, but you don’t really need to do much more than
create the class that does the comparison. In general, I like giving you some latitude in how you
design and implement your projects. However, for this assignment, each piece is very specific as
to how I want you to implement things. There are a number of parts to this program. Make
certain you accomplish the two additions to the Card class early-on since much of the rest of
your program will depend on that work.
The requirements:
Properly named project, good code (avoid redundancy), nice UI, etc. (20 pts)
Implement the Comparable interface in the Card class. (15 pts)
Sort the cards lowest to highest based on suit within rank, e.g.
2 clubs
2 diamonds
2 hearts
2 spades
3 clubs
3 diamonds
etc.
Add a static nested class to the Card class that implements the Comparator interface. (15 pts)
Sort the cards lowest to highest based on rank within suit, e.g.
2 clubs
3 clubs
4 clubs
5 clubs
etc.
In the UI, add the following to your interface.
Deal Button (10 pts)
Implement the Deal action handler using an inner class (not local). You may want to pull some
of the code from the show method that is already there. Or better, put the common code into a
class and call it.
Fish Sort Button (15 pts)
Sort the code in a way that would be useful playing Go Fish. I.e. with all of the cards grouped
together. Implement the action handler using a lambda expression in the UI. The code in the
lambda expression should depend on the Card class for the actual sorting (i.e. the natural order).
It must not call any other method in the UI class.
Spades Sort Button (15 pts)
Order the cards in such a way that they would be useful playing Spades; i.e. with the cards sorted
by rank within suit and the suits in the order pro.
This document provides an introduction to using MATLAB for numerical computations and graphical output. It describes how to launch MATLAB, perform basic arithmetic operations and matrix calculations, use loops to iterate calculations, and generate different types of plots and graphs including sine waves, bar graphs, and subplots. The exercises walk through examples of these MATLAB functions and commands to familiarize users with its interface and capabilities.
The Ring programming language version 1.2 book - Part 36 of 84Mahmoud Samir Fayed
The document describes a game engine for 2D games created using Ring. It has the following layers:
1) Games layer uses declarative programming to create games.
2) Game engine classes layer uses object-oriented programming for classes like Game, Sprite, etc.
3) Interface layer hides differences between graphics libraries (Allegro, SDL) for a consistent API.
4) Graphics library bindings generate C code from configuration files to interface with Allegro and SDL.
The engine provides classes for games, objects, sprites, text, animation and sound. Examples show creating a game window, drawing text, playing sounds, and animating sprites. The engine handles input and updating the game loop.
This document provides useful Excel macros and functions. It includes macros for deleting blank columns, uploading rows over 65,536, and removing unnecessary columns. Formulas are presented for finding matching values in two columns, and showing distinct values in a column.
(download for flawless quality) State Monad - Learn how it works - Follow Alvin Alexander’s example-driven build up to the State Monad and then branch off into a detailed look at its inner workings.
Hey i have attached the required file for my assignment.and addisorayan5ywschuit
Hey i have attached the required file for my assignment.
and additionally i have also mentioned the points of assignments below.
this one is based on this concept.
Lab 4 (Collection Framework, Exception,
IO Handling, Generic method and GUI Programming)
NOTE: You should properly format your source code files for better readability and write
appropriate comments in the code.
Exercise
1
[10
points]:
Write a program that asks a user for a file name and prints the number of characters, words (separated by whitespace), and lines in that file. Then, it prints the frequency of each word (case insensitive) containing in the file (Test1.txt); Your program should handle exceptions related to file opening and reading from the file.
This is a test this
Hi there hi hi hi
Output at the console:
Number of characters: 35
Number of words: 10
Number of lines: 2
Data written to the file (Test1.txt):
this 2
is 1
a 1
test 1
hi 4
there 1
Hint: you may use a HashMap to store and count the frequency of the words in the file.
Exercise
2
[20
points]:
Your task is to write a program that uses a textfile containing any number of lines of double values as input. Each line in the file is supposed to have no more than 15 values on it. If the file exists and each line in the file does in fact contain 15 or fewer double values, then the program processes and reports on each line in turn by displaying its line number, the number of values on that line, and the range of values on the line.
But, as you know, things are not always as they seem, or as they are supposed to be. For example, the file your program is looking for may not be there, there may be no double values at all on some lines, some lines may contain more values than the allowed maximum of 15, and some lines may contain "values" that aren't even doubles (i.e., badly formatted "invalid" double values). The program must recognize and respond appropriately to each of these problems.
Note:
You must implement exception handling. Not only am
I
requiring it, but Java itself will also require it since you will have to use Java resources that force you to deal with the IOException. In addition to this exception, you are also required to handle the ArrayIndexOutOfBounds and the NumberFormatException at appropriate points in your program.
This program reads in, from the command line, the name of a textfile containing any number of lines of doubles and then processes each line in turn. Processing a line means computing and then reporting, for that line, its line number, along with the range of values on the line.
The program can recognize a number of problems that may occur when trying to process such a file. First, the file itself may not be present. If so, the following message is displayed (the first line comes from the system, the second from the program itself):
filename.ext (The system cannot find the file specified) Program will now terminate. ...
VISUAL BASIC 6 - CONTROLS AND DECLARATIONSSuraj Kumar
1. The document discusses various data types and controls available in VB.NET including textboxes, labels, combo boxes, list boxes, checkboxes and option buttons.
2. It describes how to declare and initialize variables of different data types like strings, integers, and doubles. Arrays can be single or multi-dimensional.
3. The various controls are described including their properties and common events. Methods like AddItem and RemoveItem are discussed for dynamically populating combo boxes and list boxes.
This document provides an overview of panels and layout in WPF. It discusses the built-in panels like Canvas, StackPanel, WrapPanel, DockPanel and Grid. It also covers layout properties, transforms, creating custom panels, and the two phase layout process of measure and arrange.
For more course tutorials visit
www.tutorialrank.com
Week 1 HomeworkCommand Line in Windows and Linux
• Using Google, research what kernel operating systems have been used in the video gaming industry. Describe the architecture and details regarding its advantages or disadvantages (i.e, consider Windows, Linux, based, etc.). A minimum of two paragraphs of research information is required, along with your own interpretation of the content.
• Using Google, research the use of parallelism and concurrency in video gaming today. Describe how each
For more course tutorials visit
www.tutorialrank.com
Week 1 HomeworkCommand Line in Windows and Linux
• Using Google, research what kernel operating systems have been used in the video gaming industry. Describe the architecture and details regarding its advantages or disadvantages (i.e, consider Windows,
This document outlines the tasks for Part 1 of a project on object-oriented programming. Students are asked to implement missing methods in the Coordinate and TTTBoard classes to support playing Tic Tac Toe on various board sizes. They should then test the graphical and command line interfaces, documenting the results. Optional challenge tasks involve implementing the games Connect Four and Go. Deliverables include a project report with specified sections due by December 6th.
This programming assignment involves implementing an AI for a sliding tile puzzle game using the A* search algorithm. Students will create classes to represent the game board, potential moves, heuristics, and a solver. The solver will use A* to find the shortest sequence of moves to solve the puzzle by maintaining open and closed lists of potential moves. The main program will allow a user to play the game and request the optimal solution from the solver.
This document discusses structured programming and arrays. It begins by introducing arrays as a way to store multiple values in a structured manner using indices, rather than individual variables. It then discusses how to input and output values from arrays using loops. It also covers multidimensional arrays and declaring arrays. The document provides examples of using arrays to store and manipulate data, such as finding averages and min/max values. It concludes by introducing bubble sort as a way to sort arrays into order.
Similar to Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf (20)
in C++ , Design a linked list class named IntegerList to hold a seri.pdfeyewaregallery
in C++ , Design a linked list class named IntegerList to hold a series of integers. The class must
have public member functions for appending , inserting, deleting and displaying nodes. The
append function must append a node to the end of the list. The insert function must insert node in
ascending order. The delete function must delete the node with the given value. The display
function should display the list from head to tail. The IntegerList class should also have a
destructor that destroys the list and release memory. The list node must be declared as a structure
using keyword struct. This structure is a private member of IntegerList. You should also store the
head of the list as a private member.
Write a test program to test the implementation your IntegerList class works properly.
Solution
Here is the code for the above scenario:
#include
using namespace std;
struct ListNode
{
float value;
ListNode *next;
};
ListNode *head;
class LinkedList
{
public:
int insertNode(float num);
int appendNode(float num);
void deleteNode(float num);
void destroyList();
void displayList();
LinkedList(void) {head = NULL;}
~LinkedList(void) {destroyList();}
};
int LinkedList::appendNode(float num)
{
ListNode *newNode, *nodePtr = head;
newNode = new ListNode;
if(newNode == NULL)
{
cout << \"Error allocating memory for new list member!\ \";
return 1;
}
newNode->value = num;
newNode->next = NULL;
if(head == NULL)
{
cout << \"List was empty - \" << newNode->value;
cout << \" is part of list\'s first node.\ \";
head = newNode;
}
else
{
while(nodePtr->next != NULL)
nodePtr = nodePtr->next;
nodePtr->next = newNode;
}
return 0;
}
int LinkedList::insertNode(float num)
{
struct ListNode *newNode, *nodePtr = head, *prevNodePtr = NULL;
newNode = new ListNode;
if(newNode == NULL)
{
cout << \"Error allocating memory for new list member!\ \";
return 1;
}
newNode->value = num;
newNode->next = NULL;
if(head==NULL) {
cout << \"List was empty - \" << newNode->value;
cout << \" is part of list\'s first node.\ \";
head = newNode;
}
else
{
while((nodePtr != NULL) && (nodePtr->value < num)) {
prevNodePtr = nodePtr;
nodePtr = nodePtr->next;
}
if(prevNodePtr==NULL)
newNode->next = head;
else
newNode->next = nodePtr; prevNodePtr->next = newNode;
}
return 0;
}
void LinkedList::deleteNode(float num)
{
struct ListNode *nodePtr = head, *prevNodePtr = NULL;
if(head==NULL) {
cout << \"The list was empty!\ \";
return;
}
if(head->value == num) {
head = nodePtr->next;
delete [] nodePtr;
}
else
{
while((nodePtr!= NULL)&&(nodePtr->value != num)) {
prevNodePtr = nodePtr;
nodePtr = nodePtr->next;
}
if(nodePtr==NULL)
cout << \"The value \" << num << \" is not in this list!\ \";
else {
prevNodePtr->next = nodePtr->next;
delete [] nodePtr;
}
}
}
void LinkedList::destroyList()
{
struct ListNode *nodePtr = head, *nextNode = nodePtr;
if(head==NULL) {
cout << \"The list is empty!\ \";
return;
}
while (nodePtr != NULL) {
nextNode = nodePtr->next;
delete [] nodePtr;
nodePtr = nextNode;
}
}
void LinkedList.
In addition to the fossil record, what other kinds of evidence reinfo.pdfeyewaregallery
In addition to the fossil record, what other kinds of evidence reinforce the evolutionary of life?
You may want to use your textbook as a reference.
Solution
In addition to fossil record, application of Molecular Systematics is very much helpful for easy
identification of fossilized organism. Molecular systematics involves comparisons of nucleic
acids or other molecules to presume the degree of relatedness which can disclose phylogenetic
relationships which usually cannot be determined by non-molecular methods like comparative
anatomy. For example, molecular systematics helps us to uncover evolutionary relationships
between groups and allow us to reconstruct phylogenic trees among groups of present-day
organisms for which the fossil record is poor or lacking entirely. For example, the DNA that
encodes for ribosomal RNA (rRNA) changes comparatively slowly. Therefore, comparisons of
DNA sequences in these genes are valuable for investigating relationships between taxa that
diverged hundreds of millions of years ago. Other molecular methods useful for determining
phylogeny from fossil record include Nucleic acid sequencing, Genomic fingerprinting (RFLP)
and Amino acid sequencing..
How much 0.521 M NaOH will be needed to raise the pH of 0.161 L of 4.pdfeyewaregallery
How much 0.521 M NaOH will be needed to raise the pH of 0.161 L of 4.51 M ascorbic acid
(H2C6H6O6) to a pH of 11.60?
Solution
pH of acidic buffer = pka2 + log(salt/acid)
No of mol of ascorbic acid = 0.161*4.51 = 0.726 mol
No of mol of salt = x mol
pka2 = 11.6, pH = 11.6
11.6 = 11.6 + log(x/(0.726-x))
x = 0.363
NO of mol of NaOH required = 2x = 2*0.363 = 0.726 mol
volume of NaOH must take = 0.726/0.521 = 1.4 L
answer: 1.4 L.
I am writing a program that places bolcks on a grid the the sape of .pdfeyewaregallery
The document is a code snippet that defines classes for different shapes (O, I, L, S, X, U) used in a program that places blocks in different letter shapes on a grid. The code provides constructors for each shape that initialize the x and y coordinate arrays for each shape. It also includes functions to get the name and size of each shape, as well as a function to check if two shapes overlap.
How do teams bring value to an organizationHow are high performin.pdfeyewaregallery
How do teams bring value to an organization?
How are high performing teams built?
When a team is working well together and the project is proceeding as planned what can happen
to derail even the high performing teams?
Solution
Teams are of important value to any organization as they determine not only the success of an
organization but also the level with which the organization grow.
1. Teams bring about exchange of ideas which benefit the organization in terms of innovation
as well as different ways of approaching difficulties.
2. Teams use the skill sets that come varied personalities to form a comprehensive part of the
work force.
3. Teams help an organization to develop good communication and commitment values a
factor that strengthens an organization both internally and externally.
4. Teams help organizations realize goals set through combination of effort.
High performing teams are build through choosing of a visionary, enthusiastic and committed
team leader. The leader then sets to choose a group of equally visionary, skilled and hard
working individuals who are united and willing to work towards a common goal a process that
entails forging of trust between the leader and the team. The team is then put through various
projects in which it is expected to complete with utmost success a process which defines and
makes the team better with team to a level of high performance.
1. Calamities such as sickness or death or a team member may derail the high performance.
2. Lack of motivation especially by the team leader may derail the high performance.
3. Laziness may be also stand as a factor especially when the teams assume that the set
objectives have been achieved
4. Conflict amongst the team members or the team leader and members may derail the teams\'
performance..
how can we use empricism to figure out if a fact is trueSolutio.pdfeyewaregallery
how can we use empricism to figure out if a fact is true?
Solution
Empiricism is nothing but Knowledge by observation. Nothing is accepted without touching it,
Experiencing it or sensing the things directly.
So, empiricism helps a person to accept that fact by working on it or experimenting on it.
Empiricism demands logic to believe any particular fact to accept.
By using these many ways one can believe the fact is true from Empiricism..
Gene RegulationFunction of transcription factor domains, i.e. DNA.pdfeyewaregallery
Gene Regulation:
Function of transcription factor domains, i.e. DNA binding vs. activation domain and co-
activators. Explain how they affect gene regulation in DNA.
Solution
Transcription is the process of synthesis of RNA from DNA template a- a fist step in gene
expression.The enzyme RNA polymerase copies a particular segment of DNA into RNa and it
represents the primary level at which gene expression is regulated in prokaryotes and eukaryotic
systems .the mechanism is similar in both prokayotes and eukaryotes .
In eukaryotic systems distinct factors known as the transcription initiation factors are required
and have a promoter region upstream from the gene or an enhancer region either up or
downstream from the gene and with specific motifs that are recognized by various types of
transcription factors .
The transcription factors bind and attract other transcripton factors to create a complex thus
facilitating the binding of RNA polymerase ii and hence the process of transcription. These
transcription factors are classified into genreral transcription factors which represent the basic
transcription machinery and gene specific transcription factor.
The transcrption factors are specific proteins that are required for RNA polymerase II to initiate
transcrption and contain one or more DNA binding domains (DBD) which attach to specific
DNA sequence adjacent to the gene that they regulate.
DNA binding domains is an independently folded domain which contains one motif that can
recognize a specific DNA sequence or general affinity to DNA. There are several different type
of DNA binding domains like the Helix turn Helix domain, Zinc finger domain ,Dimerization
domain , Leucine zipper etc.
Helix turn Helix domain: is characteristic of DNA binding proteins, composed of two -helices
joined by a short strand of amino acids and is found commonly in several proteins that regulate
gene expression. helix-turn-helix proteins include the homeodomain proteins, which play critical
roles in the regulation of gene expression during embryonic development
Zinc finger domain :They contain repeats of cysteine and histidine residues that bind zinc ions
and fold into looped structures that bind DNA first identified in the polymerase III transcription
factor TFIIA but are also found in transcription factors that regulate polymerse II promoters.
,Dimerization domain :,These domains bring about dimerization of two polypeptide chains as
seen in helix turn helkix domians , leucine zipper domain.
The transcrptional activator domains or the TAD are the regions of transcription factors which in
conjunction with DNA binding domain can activate transcrption from promoter by contacting
transcriptional machinery either directly or through other protein coactivators.
The transcriptional repressor domain TRDS are the regions of the transcription factors which in
conjuation with the DNA binding domain can repress transcirption from a promoter by
contacting transcrptional machinery eit.
For each step of DNA replication, predict the outcome ifconcentra.pdfeyewaregallery
For each step of DNA replication, predict the outcome if:
concentration of nitrogenous bases is low
primase is inhibited
DNA polymerase were inhibited
DNA ligase were inhibited
Helicase were inhibited
AND
Identify cellular process(es) that require DNA replication
THANKS
Solution
concentration of nitrogenous bases is low- DNA molecule is made up of nitrogenous bases
adenine, guanine, cytosine, and thymine. These nitrogenous bases form the template and the
sequence of DNA in replication. They specify the order of these bases in the complementary
template strand being formed.
primase is inhibited- Enzyme primase is of key importance in DNA replication because it is the
only enzyme that can initiate DNA synthesis strand without an initial PNA or CNA primer.
Hence primase is essential as it catalysis the synthesis of a primer complementary to ssDNA
template aiding in the initiation of DNA replication to take place.
DNA polymerase were inhibited- DNA polymerase is an essential enzyme involved in the repair
of any damage to DNA molecule and it also plays a vital role in DNA replication; it connects the
Okazaki fragments (complementary fragements to the lagging template strand ) by deleting RNA
primers and replacing it with DNA.
DNA ligase were inhibited- Ligase enzyme is useful in DNA repair (single-strand or double-
strand breaks of DNA) and in replication by joining the double DNA strands through
phosphodiester bond formation (3\'OH end and 5\'P end). DNA double helicular structure is thus
formed through ligation of both strands on replication.
Helicase were inhibited- Helicases help in the seperation of nucleic acid strands required during
the cellular processes like DNA replication, transcription, repair. This seperation is done by
Helicase enzyme by moving through a nucleic acid phosphodiester backbone that exists in DNA,
RNA, or DNA-RNA hybrid.
cellular process that require DNA replication- In mitosis DNA replication is essential (S stage of
interphase) which gets distributed to the resulting daughter cells at the end of cytokinesis. This
ensures two similar daughter cells having common genetic material..
Explain THREE unique characteristics of fungi.SolutionThree un.pdfeyewaregallery
Explain THREE unique characteristics of fungi.
Solution
Three unique characteristics of fungi are-
1)Fungi are filamentous and not truly multicellular. They are composed of unique thread-like
filamentous structures called hyphae. In higher fungi, these hyphae anastomose to form a
network called mycelium.The cell wall of fungi is composed of chitin or cellulose. Fungi can
build mutual relationships with other organisms in order to get nutritional benefits from such
association. For example: The symbiotic relationship between funfi and algae is called lichen.
2) They need preformed food, optimum temperature, pH and moisture to grow properly. In order
to avoid dessication, they also require some amount of water to grow. They are resistant to
osmotic pressure and hence, can grow in relatively high salt and sugar concentrations.
3)Fungi are heterotrophic and they lack plastids.They collect nutrients from the environment,
from dead or living organisms. Fungi are capable of metabolising complex carbohydrates (like
lignin)..
Explain the basic relationship between humans and microorganisms.pdfeyewaregallery
Explain the basic relationship between humans and microorganisms
Solution
Answer=
The basic relationship between humans & microorganisms are as follows
The surfaces of human body inside & outside ,for example skin ,mouth & intestines are covered
in millions of individual microbes
The microbes that do not harm in fact they helps to protect us becoming infected with harmful
microbes they are known as normal body flora
There are 3 types of symbiotic relationships between humans & bacteria
1] Commensalism = Is a relationship that is beneficial to the bacteria ,but does not help or
harmthe host
most are reside on epithelial surfaces that come in contact with the external environment
commonly found on skin ,respiratory tract & gastrointestinal tract
They aquire nutrients & place to live & grow from their host
some are pathogenic & cause disease may provide benefit to host
2] Mutuliastic relationship-=
Both bacteria & host are beneficial
for example there are several kinds of bacteria that live on skin & inside the mouth ,nose,throat
& intestines of humans
These bacteria received a place to live & feed while keeping other harmful microbes from taking
up residence
bacteria in digestive system assist in nutrient metabolism ,vitamin production & waste
processing
3] Parasitic relatioship= is one in which the bacteria benefit while the host is harmed
pathogenic parasites ,which cause disease,do so by resisting the hosts defences & growing at the
expense of host
These bacteria produces poisonous substances called endotoxins & exotoxins are responsible for
the symptoms to occure with an illness
Disease causing bacteria are responsible for a number of diseases including meningitis
,pneumonia .tuberculosis& several types of food borne diseases.
discuss the rationale for the global harmonization of financial repo.pdfeyewaregallery
discuss the rationale for the global harmonization of financial reporting and disclosure
requirements
Solution
The focus and rationale of global harmonization of financial reporting and disclosure
requirements is for achieving a level of compatibility for the statements. There is less
complication for the companies and individuals to present the financial statements and its
interpretations. The differences between financial reporting standards are erased with
international harmonization of financial reporting.
When there is achievement of international harmonization in finial reporting then it benefits
countries and improves the access effectively for the financial market. The confidence and
investor\'s K owned he is increased. According to Wiley (2000) even though the rationale behind
harmonization is smooth preparation and presentation of financial statements; there may be
differences based on the factors like taxation and political aspects.
It focuses on creation of similar set of procedures with the help of boundary establishment and
how they can differ globally.
It also benefits accounting standards on national and international levels.
The disclosure requirements include the information related to nature and the extent of risks
which arises from financial instruments. The importance of financial instutments for the purpose
of finial position and performance of entity. It includes financial assets, held to maturity
investments, loans and receivables, sale assets etc..
Describe the need to multitask in BBC (behavior-based control) syste.pdfeyewaregallery
Describe the need to multitask in BBC (behavior-based control) systems?
Solution
Behavior-based control employs a set of distributed, in-teracting modules, called behaviors that
collectively achieve the desired system-level behavior. To an ex-ternal observer, behaviors are
patterns of the robot’s activity emerging from interactions between the robot and its
environment. To a programmer, behaviors are control modules that cluster sets of constraints in
order to achieve and maintain a goal. Each behavior receives inputs from sensors and/or other
behaviors in the system, and provides outputs to the robot’s actuators or to other behaviors. Thus,
a behavior-based controller is a structured network of interacting behaviors, with no centralized
world representation or focus of control. In-stead, individual behaviors and networks of
behaviors maintain any state information and models.
The basic principles of behavior-based control can be summarized briefly as follows:
• Behaviors are implemented as control laws (some-times similar to those used in control
theory), either in software or hardware, as a processing element or as a procedure.
• Each behavior can take inputs from the robot’s sen-sors (e.g., proximity sensors, range
detectors, contact sensors, camera) and/or from other modules in the
system, and send outputs to the robot’s effectors (e.g., wheels, grippers, arm, speech) and/or to
other modules.
• Many different behaviors may independently re- ceive input from the same sensors and output
action commands to the same actuators.
• Behaviors are encoded to be relatively simple, and are added to the system incrementally.
• Behaviors (or subsets thereof) are executed con- currently, not sequentially, in order to exploit
parallelism and speed of computation, as well as the interaction dynamics among behaviors and
between behaviors and the environment.
The ability to improve performance over time and to reason about the world, in the context of a
chang-ing and dynamic environment, is an important area of research in situated robotics. Unlike
in classical ma-chine learning, where the goal is typically to optimize performance over a long
period of time, in situated learning the aim is to adapt relatively quickly, toward
attaining efficiency in the light of uncertainty. Models from biology are often considered, given
its proper- ties of learning directly from environmental feedback. Variations and adaptations of
machine learning, and in particular reinforcement learning, have been effectively applied to
behavior-based robots, which have demon- strated learning to walk [38.
, navigate and create topological maps, di-vide tasks, behave socially , and even identify
opponents and score goals in robot soc-
cer. Methods from artificial life, evolutionary computation/genetic algorithms, fuzzy logic,
vision and learning, multi-agent systems, and many other research areas continue to be actively
explored and applied to behavior-based robots as their role in ani.
A spinner with 7 equally sized slices is shown below. The dial is spu.pdfeyewaregallery
A spinner with 7 equally sized slices is shown below. The dial is spun and stops on a slice at
random. What are the odds in favor of landing on a black slice?
Solution
4 slice grey
1 black slice
2 white slice
odds are ratio of favorable outcomes to non favorable outcomes
Odds in favour of landing on a black slice = 1:6.
ble below to calculate the Gross Domestic Product uning the ral Gro.pdfeyewaregallery
ble below to calculate the Gross Domestic Product uning the ral Gross Domestic Product? Fully
explain your anower. (4 mak) or rea overnment expenditures on goods and service Wages,
salaries and supplementary labour income 2,000 reciation nvestment 400 sumption expenditure
et exports direct taxes 150
Solution
Gross domestic product be expenditure method= consumption expenditure+ government
expenditure+ investment+ net export
=2200+500+400+(-50)
=3050
This is the nominal GDP as well as real GDP because base year price and current year price is
not given.
Hence real GDP and nominal GDP will be same..
1.The limbic systemA. matures before the prefrontal cortexB. is.pdfeyewaregallery
1.The limbic system:
A. matures before the prefrontal cortex
B. is another name for the prefrontal cortex
C. is responsible for emotional regulation and impulse control
D. matures before the amygdala
Solution
The limbic system is responsible for emotional regulationand impules control.
Limbic system is that portion of the brain which deals with the emotions, arousal, learning aw
well as formation of memories. It has a complicated structure that lies on the both side of the
thalamus just beneath the cerebrum. It includes amygdala, hippocampus, thalamus,
hypothalamus, basal ganglia and cingulate gyrus.
Amygdala also known as the emotional centre of the brain. Hippocampus helps in the formation
of new memories from our past experinces. While thalamus and hypothalamus are governs the
changes occuring to the emotional activities. Basal ganglia involved in motor control and habbit
learning. And cingulate gyrus manage smell and sight and regulate our behaviour..
Why is leadership a critical factor in implementing change and qua.pdfeyewaregallery
Why is leadership a critical factor in implementing change and quality improvement initiatives?
Why is leadership a critical factor in implementing change and quality improvement initiatives?
Solution
Leadership is required for inspiring and motivating followers to work towards common
objectives. The leader employs enthusiasm and charisma to motivate the employees to think out
of the box.Leader lays emphasis on the values, morals, ideas and needs of the organization and
the followers.
Leadership is critical for transformation and change in the firm in a turbulent and challenging
environment. By concentrating on innovation and creation rather than just daily planning and
execution, the leader ensures that the changes are implemented with minimum resistance.
Below is how the leaders can implement change and quality improvement initiatives while
overcoming resistance-
1. Communicating the objective of the change and how it would positively affect the
productivity of the employees and the organization
2. Developing training and mentoring programs to train the employees to adopt to the new
process or system
3. Removing fears from the minds of employees through openhouse discussions etc.
4. Explaining the employees how the change would help in the development of the individuals..
Why are there bubbles in beer and champagneSolution Bubbles of .pdfeyewaregallery
Why are there bubbles in beer and champagne?
Solution
Bubbles of gas, typically carbon dioxide are produced from beer and champagne , rising to the
surface. Because . yeasts ferment sugars and form carbon dioxide gas during fermentation. In the
bottle, where the pressure is high, the carbon dioxide disappears. However, when you open the
bottle and lower the pressure, the carbon dioxide escapes in the form of bubbles. In Champagne
and other sparkling wines, the bubbles pop, while in beer, the bubbles remain and form the
beer\'shead..
Which of the following is true of a traditional master budget a. It.pdfeyewaregallery
Which of the following is true of a traditional master budget? a. It uses the zero-base budgeting
approach. b. It is department oriented. c. It recognizes interdependencies. d. It is dynamic in
nature.
Solution
Correct Answer is b. it is department Oriented
One of the critisism of Traditional Master Budget is that it is Department oriented and does not
recognise independencies among departments, further it is static not dynamic in nature..
Which ethnic groups were a part of the former YugoslaviaCroats, S.pdfeyewaregallery
Which ethnic groups were a part of the former Yugoslavia?
Croats, Serbs, Bosnian Muslims, Macedonians
Janjaweed
Israelis, Palestinians, Arabs
Hutu & Tutsis
Croats, Serbs, Bosnian Muslims, Macedonians
Janjaweed
Israelis, Palestinians, Arabs
Hutu & Tutsis
Solution
The ethnic group can be defined as a social category based on common culture or nationality.
In other words, it can be said that an ethnic group is a category of people who recognize with
each other based on similarities for example as a common ancestry, language, society, culture or
nation.
First Yugoslavia contains people of the Kingdom of Serbs, Croats and Slovenes (1918–29).
Hence it can be said that the ethnic groups which were a part of the former Yugoslavia were
Croats, Serbs, Bosnian Muslims, Macedonians.
Hence option first is the correct answer.
Option first; Croats, Serbs, Bosnian Muslims, Macedonians.
What would the components of the development be in an early learning.pdfeyewaregallery
What would the components of the development be in an early learning(1st – 3rd) website
environment be?
Solution
For a website,major components include Front end,images,contents navigation,page structure.
For early learning website.As it for the children,content along with effective graphic design is
most preferable.
Graphic design:
Many of the elements described, such as the logo, the navigation menus, the layout, images, etc.,
fall under the general category of graphic design. But graphic design is more than these. It is the
look and feel the website will have as a result of proper use and integration of all these elements.
Content management is considered.
The website is not recommended to be a static as it should be more creative and changes is
necessary.
Content management system:
This is the ability to update your website without having to directly edit the html. Simple
systems create areas on a web page that can be easily changed on a regular basis.
Include multiedia and databases.
Multi-media.
It is for than just text and images. Photo-tours, video-clips, sound-clips all can add to the
experience if they are well matched to the type of site and profile of the target audience..
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumMJDuyan
(𝐓𝐋𝐄 𝟏𝟎𝟎) (𝐋𝐞𝐬𝐬𝐨𝐧 𝟏)-𝐏𝐫𝐞𝐥𝐢𝐦𝐬
𝐃𝐢𝐬𝐜𝐮𝐬𝐬 𝐭𝐡𝐞 𝐄𝐏𝐏 𝐂𝐮𝐫𝐫𝐢𝐜𝐮𝐥𝐮𝐦 𝐢𝐧 𝐭𝐡𝐞 𝐏𝐡𝐢𝐥𝐢𝐩𝐩𝐢𝐧𝐞𝐬:
- Understand the goals and objectives of the Edukasyong Pantahanan at Pangkabuhayan (EPP) curriculum, recognizing its importance in fostering practical life skills and values among students. Students will also be able to identify the key components and subjects covered, such as agriculture, home economics, industrial arts, and information and communication technology.
𝐄𝐱𝐩𝐥𝐚𝐢𝐧 𝐭𝐡𝐞 𝐍𝐚𝐭𝐮𝐫𝐞 𝐚𝐧𝐝 𝐒𝐜𝐨𝐩𝐞 𝐨𝐟 𝐚𝐧 𝐄𝐧𝐭𝐫𝐞𝐩𝐫𝐞𝐧𝐞𝐮𝐫:
-Define entrepreneurship, distinguishing it from general business activities by emphasizing its focus on innovation, risk-taking, and value creation. Students will describe the characteristics and traits of successful entrepreneurs, including their roles and responsibilities, and discuss the broader economic and social impacts of entrepreneurial activities on both local and global scales.
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
This presentation was provided by Rebecca Benner, Ph.D., of the American Society of Anesthesiologists, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
1. Lab Assignment 17 - Working with Object Arrays
In the old days we would do these projects as applets. Unfortunately, applets are not as secure as
Sun / Oracle once thought they were. Now, it is almost impossible to run an applet over the web.
If you want to see how the Tic-Tac-Toe game looks you will have to view this video
In this homework, you'll build your own version of TicTacToe using JLabels, GridLayout, and a
couple arrays. Before you get started, however, why don't you take a minute to play a game?
Declare a two-dimensional array of primitive values
Declare a two-dimensional array of object references
Initialize each of the elements in a two-dimensional array of object references
Use a pair of nested for loops to process the elements in a two-dimensional array
Create a class called TicTacToe. Place it in a file called TicTacToe.java
Have your class extend from JFrame
Have your class implement ActionListener and MouseListener.
Create all of the methods needed for the ActionListener and MouseListener interfaces.
Make sure to import javax.swing.*, java.awt.* and java.awt.event.*
Before ddefining your attributes you need to create a container called content and initialize it by
sending the getContentPane() message to this.
Define your application's attributes. The TicTacToe program has three different kinds of fields
that you must define before you can compile the program successfully. Make sure you define
your fields and check for errors before you attempt to go further.
Here are the three kinds of fields:
1. Program Arrays
The TicTacToe program has two "parallel", 3 x 3, two dimensional arrays. Start your
programming by defining these two arrays:
The first of these is an array of JLabel objects. This array, named grid, is used to display the
actual Xs and Os on your screen. Each JLabel will display an X, and O, or a blank.
The second array is an array of char primitives. This array, named game, is used to simplify
keeping score as the game is played. Each element in game contains a space ' ' if the position
has yet to be played, an 'X', if the position contains an X, and an 'O' if the position contains an
O.
2. Graphical User-interface Fields
In addition to the JLabels that make up the array named grid, the TicTacToe application contains
the following user-interface elements. Define these elements after you've finished defining your
arrays:
A JButton object named restart. The user can restart the game by clicking this Button.
2. A JPanel named p. Use the default constructor to create p; it will hold the JLabels in grid
A JLabel named status. This will keep the user informed of the game's progress. You might
want to initialize status to a helpful welcome message.
3. Primitive Fields
Your program will contain the following primitive fields which you'll use as you play the game:
An int named numClicks that will keep track of how many X's and O's are displayed.
A boolean named isDone which is used to determine when the game is finished. Initialize
isDoneto false.
A boolean named isXTurn which is used to determine whose turn it is to click. Initialize isXTurn
to true--we'll assume that X always goes first.
Once you've defined these fields, make sure your program contains no errors. If it does, then
you've made a mistake defining the fields; go back and double-check your work until the errors
have disappeared.
Write the constructor. There are four tasks to complete in this step. After you've finished writing
the constructor, check one last time for errors before going on. When you finish this step, you
should be able to run your application and see that its appearance is satisfactory.
1. Set the Layout
Your application will use BorderLayout for the application itself, even though the JPanel that
contains the game's labels will use a GridLayout. Since the BorderLayout is the default layout
for swing you will not have to set the layout on the content pane.
2. Add the Status Label
Add the JLabel named status to the top of your application. When you do so, also change the
JLabel's appearance like this:
Swing components by default are transparent so they take on the background color of the
container they are added to. Because of this, you must send your status JLabel the
setOpaquemessage passing a parameter of true
Set the JLabel background to yellow, the foreground to blue
Set the JLabel font to a nice 12pt bold Helvetica
3. Initialize the main Panel
You want to display the JLabel objects in the grid array using a 3 x 3 grid on the screen.
Fortunately, Java's GridLayout is just what you need. Before you add the JLabel objects to your
JPanel, however, there are a few things you need to do to prepare your main JPanel.
Use the setLayout() method to change the JPanel object p so that it uses a GridLayout. Leave
three pixels between cells in the grid.
Change the JPanel's background color to black. (This adds the lines between JLabels.)
Add the JPanel to the center of the content pane.
3. 4. Initialize the grid
In Step 1, you created a 3 x 3 array of JLabel references named grid. Each of the elements in
grid, however, is not yet a JLabel; instead grid is populated with 9 nullJLabel references. To fix
that, you need to use a pair of nested for loops to create 9 JLabel objects and place them into
your array.
Here's what you do. Write a pair of nested for loops. Use row for the outer loop index and have
it go from 0 to 2. Use col for the inner loop index and have it go from 0 to 2. Inside the inner
loop, do the following:
Create a JLabel object using new, and place it in the corresponding element in the array.
(grid[row][col]).
Attach a MouseListener to the JLabel object using addMouseListener(this). Note that this is
different than using MouseMotionListener.
Send the JLabel the setOpaque message passing it a parameter of true
Set the background of the JLabel to white
Change the font used by the JLabel to a 32 point, bold Helvetica
Add the JLabel to the JPanel named p.
While you are still in the inner loop, place a space in the current element of the char array named
game. Because both grid and game have the same number of dimensions, you can use the
[row][col] indexes on game as well as grid.
At this point, your constructor is finished. Make sure you do not have any errors. You should at
this point be able to run your application and see the basic outline of what the TicTacToe game is
going to look like.
Handle the mouse clicks. The code to handle mouse clicks is placed in a method named
mouseClicked(). You could have placed the code in the methods mousePressed() or
mouseReleased()as well. Under Java 1.0 you could have used the mouseDown() or mouseUp()
methods.
This is a fairly complex method and is somewhat difficult to explain clearly. For this reason the
mouseClicked code is being given to you:
Create the gameOver method. In this method you are going to first check the horizontals then
check the rows and columns using a for loop. When you are doing your checking think about the
decision statements you are using. Should you have a bunch of if statements or should they be if
else statements. Here are the steps to complete the method:
Create a local char variable called winner. Initialize it with a space character.
TTo check the first diagonal you will determine if the character at game[0][0] is equal to the
character at game[1][1] and game[2][2]. If they are equal set winner equal to game[0][0].
Checking the second diagonal is very similar to the first. You simply need to go the other
4. direction. That is, check to see if game[2][0] is equal to game[1][1] and game[0][2]. If they are
then set winner equal to game[2][0].
If a winner hasn't been determined in the diagonal spaces you next need to check the rows. You
will need a for loop that runs from 0 to 3. So that we are on the same page call your loop counter
strong>row.
Within the for loop you are going to check both the rows and columns. To check the rows you
should check that game[row][0] is not equal to an empty space and that game[row][0] is equal to
game[row][1] and game[row][2]. If this is true set winner equal to game[row][0].
Checking the columns is similar to checking the rows. The difference is that you are going to put
row as the second index. So, you need to check that game[0][row] is not equal to a space
character and game[0][row] is equal to game[1][row] and game[2][row]. If this is true then set
winner equal to game[0][row]
Once the loop exits you have determined the outcome. Now you simply need to report it. Set the
field variable called isDone to true
Check for a tie. This is determined by checking to see if winner is equal to the space character
and the field variable numClicks is equal to 9. If this is true set the text on the JLabel called
status to a tie game.
If it is not a tie game then check for a winner. If winner is not equal to the space character then
set the text of the JLabel called status to "Game Over:" + winner + " Won!!!"
If it is not a tie game or no winner then the game needs to continue. Set status to either "X's
Turn" or "O's Turn" by determining the value of the variable isXTurn. Also you need to set
isDone back to false.
Write the resetGame() method. This method is called to "clear out" all of the Labels whenever a
game is finished, or when the user presses the "Reset" button. Here's all you need to write:
Write a nested for loop. Use row and col for your indexes.
For each element in the Label array named grid, set the text to a single blank space using the
setText() method. [Make sure you don't set it to more than one space or to the empty
Stringaccidentally.]
Inside the same nested loop, set each element in the char array named game to a single space as
well. Here you'll have to use a char literal like this ' ', while in the previous step you need to
use a space contained inside a String like this " ".
Set the field named numClicks to zero.
Set the field named isXTurn to true.
That's it. Test it out, and you're finished.
Lab Assignment 17 - Working with Object Arrays Note About Applets
In the old days we would do these projects as applets. Unfortunately, applets are not as secure as
5. Sun / Oracle once thought they were. Now, it is almost impossible to run an applet over the
web. If you want to see how the Tic-Tac-Toe game looks you will have to view this video
Purpose The Sun Java Development Kit (JDK) comes with a sample program that plays
TicTacToe. The JDK program includes sounds and comes with cool graphics. It can be a little
slow, however, and the code is not the easiest to understand.
In this homework, you'll build your own version of TicTacToe using JLabels, GridLayout, and
a couple arrays. Before you get started, however, why don't you take a minute to play a game?
To complete the homework you'll have to understand how to:
Declare a two-dimensional array of primitive values
Declare a two-dimensional array of object references
Initialize each of the elements in a two-dimensional array of object references
Use a pair of nested for loops to process the elements in a two-dimensional array Step-By-Step
Instructions Step 1
Create a class called TicTacToe. Place it in a file called TicTacToe.java
Have your class extend from JFrame
Have your class implement ActionListener and MouseListener.
Create all of the methods needed for the ActionListener and MouseListener interfaces.
Make sure to import javax.swing.*, java.awt.* and java.awt.event.*Step 2
Before ddefining your attributes you need to create a container called content and initialize it by
sending the getContentPane() message to this.
Define your application's attributes. The TicTacToe program has three different kinds of fields
that you must define before you can compile the program successfully. Make sure you define
your fields and check for errors before you attempt to go further.
Here are the three kinds of fields:
1. Program Arrays
The TicTacToe program has two "parallel", 3 x 3, two dimensional arrays. Start your
programming by defining these two arrays:
The first of these is an array of JLabel objects. This array, named grid, is used to display the
actual Xs and Os on your screen. Each JLabel will display an X, and O, or a blank.
The second array is an array of char primitives. This array, named game, is used to simplify
keeping score as the game is played. Each element in game contains a space ' ' if the position
has yet to be played, an 'X', if the position contains an X, and an 'O' if the position contains
an O.
2. Graphical User-interface Fields
In addition to the JLabels that make up the array named grid, the TicTacToe application
contains the following user-interface elements. Define these elements after you've finished
6. defining your arrays:
A JButton object named restart. The user can restart the game by clicking this Button.
A JPanel named p. Use the default constructor to create p; it will hold the JLabels in grid
A JLabel named status. This will keep the user informed of the game's progress. You might
want to initialize status to a helpful welcome message.
3. Primitive Fields
Your program will contain the following primitive fields which you'll use as you play the game:
An int named numClicks that will keep track of how many X's and O's are displayed.
A boolean named isDone which is used to determine when the game is finished. Initialize
isDoneto false.
A boolean named isXTurn which is used to determine whose turn it is to click. Initialize
isXTurn to true--we'll assume that X always goes first.
Once you've defined these fields, make sure your program contains no errors. If it does, then
you've made a mistake defining the fields; go back and double-check your work until the errors
have disappeared.Step 2
Write the constructor. There are four tasks to complete in this step. After you've finished
writing the constructor, check one last time for errors before going on. When you finish this
step, you should be able to run your application and see that its appearance is satisfactory.
1. Set the Layout
Your application will use BorderLayout for the application itself, even though the JPanel that
contains the game's labels will use a GridLayout. Since the BorderLayout is the default layout
for swing you will not have to set the layout on the content pane.
2. Add the Status Label
Add the JLabel named status to the top of your application. When you do so, also change the
JLabel's appearance like this:
Swing components by default are transparent so they take on the background color of the
container they are added to. Because of this, you must send your status JLabel the
setOpaquemessage passing a parameter of true
Set the JLabel background to yellow, the foreground to blue
Set the JLabel font to a nice 12pt bold Helvetica
3. Initialize the main Panel
You want to display the JLabel objects in the grid array using a 3 x 3 grid on the screen.
Fortunately, Java's GridLayout is just what you need. Before you add the JLabel objects to your
JPanel, however, there are a few things you need to do to prepare your main JPanel.
Use the setLayout() method to change the JPanel object p so that it uses a GridLayout. Leave
three pixels between cells in the grid.
7. Change the JPanel's background color to black. (This adds the lines between JLabels.)
Add the JPanel to the center of the content pane.
4. Initialize the grid
In Step 1, you created a 3 x 3 array of JLabel references named grid. Each of the elements in
grid, however, is not yet a JLabel; instead grid is populated with 9 nullJLabel references. To fix
that, you need to use a pair of nested for loops to create 9 JLabel objects and place them into
your array.
Here's what you do. Write a pair of nested for loops. Use row for the outer loop index and have
it go from 0 to 2. Use col for the inner loop index and have it go from 0 to 2. Inside the inner
loop, do the following:
Create a JLabel object using new, and place it in the corresponding element in the array.
(grid[row][col]).
Attach a MouseListener to the JLabel object using addMouseListener(this). Note that this is
different than using MouseMotionListener.
Send the JLabel the setOpaque message passing it a parameter of true
Set the background of the JLabel to white
Change the font used by the JLabel to a 32 point, bold Helvetica
Add the JLabel to the JPanel named p.
While you are still in the inner loop, place a space in the current element of the char array
named game. Because both grid and game have the same number of dimensions, you can use
the [row][col] indexes on game as well as grid.
At this point, your constructor is finished. Make sure you do not have any errors. You should at
this point be able to run your application and see the basic outline of what the TicTacToe game
is going to look like.Step 3
Handle the mouse clicks. The code to handle mouse clicks is placed in a method named
mouseClicked(). You could have placed the code in the methods mousePressed() or
mouseReleased()as well. Under Java 1.0 you could have used the mouseDown() or mouseUp()
methods.
This is a fairly complex method and is somewhat difficult to explain clearly. For this reason the
mouseClicked code is being given to you:
Step 4
Create the gameOver method. In this method you are going to first check the horizontals then
check the rows and columns using a for loop. When you are doing your checking think about
the decision statements you are using. Should you have a bunch of if statements or should they
be if else statements. Here are the steps to complete the method:
Create a local char variable called winner. Initialize it with a space character.
8. TTo check the first diagonal you will determine if the character at game[0][0] is equal to the
character at game[1][1] and game[2][2]. If they are equal set winner equal to game[0][0].
Checking the second diagonal is very similar to the first. You simply need to go the other
direction. That is, check to see if game[2][0] is equal to game[1][1] and game[0][2]. If they are
then set winner equal to game[2][0].
If a winner hasn't been determined in the diagonal spaces you next need to check the rows. You
will need a for loop that runs from 0 to 3. So that we are on the same page call your loop counter
strong>row.
Within the for loop you are going to check both the rows and columns. To check the rows you
should check that game[row][0] is not equal to an empty space and that game[row][0] is equal to
game[row][1] and game[row][2]. If this is true set winner equal to game[row][0].
Checking the columns is similar to checking the rows. The difference is that you are going to
put row as the second index. So, you need to check that game[0][row] is not equal to a space
character and game[0][row] is equal to game[1][row] and game[2][row]. If this is true then set
winner equal to game[0][row]
Once the loop exits you have determined the outcome. Now you simply need to report it. Set the
field variable called isDone to true
Check for a tie. This is determined by checking to see if winner is equal to the space character
and the field variable numClicks is equal to 9. If this is true set the text on the JLabel called
status to a tie game.
If it is not a tie game then check for a winner. If winner is not equal to the space character then
set the text of the JLabel called status to "Game Over:" + winner + " Won!!!"
If it is not a tie game or no winner then the game needs to continue. Set status to either "X's
Turn" or "O's Turn" by determining the value of the variable isXTurn. Also you need to set
isDone back to false.Step 5
Write the resetGame() method. This method is called to "clear out" all of the Labels whenever
a game is finished, or when the user presses the "Reset" button. Here's all you need to write:
Write a nested for loop. Use row and col for your indexes.
For each element in the Label array named grid, set the text to a single blank space using the
setText() method. [Make sure you don't set it to more than one space or to the empty
Stringaccidentally.]
Inside the same nested loop, set each element in the char array named game to a single space as
well. Here you'll have to use a char literal like this ' ', while in the previous step you need to
use a space contained inside a String like this " ".
Set the field named numClicks to zero.
Set the field named isXTurn to true.
9. That's it. Test it out, and you're finished.
Solution
Answer:
import java.util.*;
public class TicTacToeGame
{
private int counter;
private char location[]=new char[10];
private char player;
public static void main(String args[])
{
String ch;
TicTacToeGame Toe=new TicTacToeGame();
do{
Toe.beginBoard();
Toe.play_game();
System.out.println ("Press Y to play the game again ");
Scanner in =new Scanner(System.in);
ch=in.nextLine();
System.out.println("ch value is "+ch);
}while (ch.equals("Y"));
}
public void beginBoard()
{
char locationdef[] = {'0','1', '2', '3', '4', '5', '6', '7', '8', '9'};
int i;
counter = 0;
player = 'X';
for (i=1; i<10; i++) location[i]=locationdef[i];