Free Essay

Lab5

In: Computers and Technology

Submitted By jejegh
Words 612
Pages 3
Example 1 1 public class TwoDimensionArrayTracing 2 { 3 public static void main(String[]args) 4 { 5 int row, col, n; 6 char [][] B; 7 8 n = 5; 9 B = new char[n][n]; 10 11 for (row = 0; row <= 4; row++) 12 { 13 for(col = 0; col <= B[row].length - 1; col++) 14 { 15 if(row == col || row + col == B[row].length - 1) 16 B[row][col] = 'X'; 17 else 18 B[row][col] = ' '; 19 } 20 } 21 22 for (row = 0; row <= B.length - 1; row++) 23 { 24 for(col = 0; col <= B[row].length - 1; col++) 25 { 26 System.out.print(B[row][col]); 27 } 28 System.out.println(); 29 } 30 } 31 }

Example 2 public class TwoDArray4
{
public static void main(String[ ] args) { int row, col, n; int [][] B; n = 5; B = new int[n][n]; for (row = 4; row >= 0; row--) { for (col = 4; col >= row ; col--) { if ((col == 4) || (row == col)) B[row][col] = 1; else B[row][col] = B[row+1][col+1] + B[row][col+1]; } } for (row = 0; row <= 4; row++) { for (col = 0; col <= 4; col++) System.out.print(B[row][col]); System.out.println(); }

}
}

Example 3
1 // 2 // 3 // 4 public class TwoArray 5 { 6 public static void main(String[ ] args) 7 { 8 int row, col, n; 9 int [][] B;
10
11 n = 5;
12
13 B = new int[n][n];
14
15 for (row = 0; row <= 4; row++)
16 {
17 B[row] = new int[row+1];
18 for (col = 0; col < row+1; col++)
19 {
20 B[row][col] = row*col;
21 }
22 }
23
24 for (row = 0; row <= 4; row++)
25 {
26 for (col = 0; col <= row; col++)
27 System.out.print(B[row][col]+"\t");
28 System.out.println();
29 }
30
31 } // end main()
32 } // end class TwoDArray

Example 4
1 /** 3 * @author Guillermo Zarate 4 * @author Cesar Caballero 5 * ASSIGNMENT 3 - Problem 1 * CS 207, Programming II * Computer Science - Summer, 2011 6 * The program prints out an smiley face using x and o 7 */ 8 public class array2d 9 {
10 public static void main(String[ ] args)
11 {
12 String x, o;
13 String [][] D;
14
15 o = "o";
16 x = "x";
17 D = new String[6][6];
18
19 for (int i = 0; i < D.length; i++) //Loads the array with o's to all indexes
20 {
21 for (int j = 0; j < D[i].length; j++)
22 {
23 D[i][j] = o;
24 }
25 }
26
27 for ( int i = 0; i < D.length; i++) //Assigns x to specific locations
28 {
29 for (int j = 0; j < D [i].length; j++ )
30 {
31 if ( i == 1 && j == 1)
32 D [i][j] = x;
33
34 if ( i == 1 && j == 4)
35 D [i][j] = x;
36
37 if ( i == 3 && j == 0)
38 D [i][j] = x;
39
40 if ( i == 3 && j == 5)
41 D [i][j] = x;
42
43 if ( i == 4 && j == 1)
44 D [i][j] = x;
45
46 if ( i == 4 && j == 2)
47 D [i][j] = x;
48
49 if ( i == 4 && j == 3)
50 D [i][j] = x;
51
52 if ( i == 4 && j == 4)
53 D [i][j] = x;
54
55 }
56 }
57
58 for ( int i = 0; i < D.length; i++) // Displays the 2D array in a grid form
59 {
60 for (int j = 0; j < D[i].length; j++)
61 {
62 System.out.print(D[i][j] + " ");
63 }
64 System.out.println();
65 }
66
68 }
69
70 }

Similar Documents

Premium Essay

Lab5

...TermPaperWarehouse.com - Free Term Papers, Essays and Research Documents The Research Paper Factory Join Search Browse Saved Papers Home Page » Computers and Technology Gathering Information Pertaining to a Glba Compliance In: Computers and Technology Gathering Information Pertaining to a Glba Compliance Lab#5 Define a process for Gathering Information pertaining to a GLBA Compliance 1. GLBA repealed parts of an act. Name the act and explain why it was significant for financial institutions and insurance companies. Parts of the glass Steagall act of 1933 GLBA allows financial institutions such as banks to act as insurance companies. GLBA covers both financial institutions and insurance companies since both can perform financial services for its customers. This reform requires banks and insurance companies to comply with both the privacy and safeguard rules of GLBA. 2. What is another name for obtaining information under false pretenses and what does it have to do with GLBA? What is an example of the safeguard pertinent to this requirement? Pre-texting or social engineering. GLBA specifically mentions this in title 15 US code chapter 94 sub chapter 2, section 6821. GLBA encourages companies to implement safeguards around pre-texting and social engineering. Security awareness training and periodic reminders of awareness to pre-texting and social engineering is a best practice performed within the user domain. 3. How does GLBA impact information...

Words: 343 - Pages: 2

Premium Essay

Cis247C Lab5

...// Program.cs (main program" //CIS247C Lab5 using System; class Program { static void Main(string[] args) { Console.WriteLine("\nWelcome the Employee Hierarchy Program\n"); Console.WriteLine("\n CIS247 Week 5 Lab \n"); Console.WriteLine("\n Name: Solution \n "); Console.WriteLine("\nThis program tests an Employee inheritance hierarchy\n"); Employee[] emp = new Employee[3]; emp[0] = new Employee("Joe", "Doe", 'M', 1, 10000.0, new Benefit("Partial", 1000, 2)); emp[1] = new Salaried("Zoe", "Likoudis", 'F', 3, 20000.0, new Benefit("Full", 2000, 4), 1); emp[2] = new Hourly("Kate", "Perry", 'F', 0, 75, 25, new Benefit("Partial", 3000, 8), "part time"); for (int i = 0; i < emp.Length; i++) { Console.WriteLine("\n***************** Display Employee's Data *****************\n"); Console.WriteLine(emp[i].ToString()); } Console.WriteLine("\nTotal number of employees in Database: {0}\n", Employee.GetNumberOfEmployees()); } } class Employee { protected string firstName; protected string lastName; protected char gender; protected int dependents; protected double annualSalary; private static int numEmployees = 0; protected Benefit benefit; public Employee() { firstName = "not given"; lastName = "not given"; gender = 'U'; dependents = 0; annualSalary = 20000; numEmployees++; benefit = new Benefit("not given", 0, 0); } public Employee(string first, string last, char gen, int dep, double salary,...

Words: 813 - Pages: 4

Free Essay

Elec3 Lab5

...I. Objectives * Familiarize with the different tools in cracking passwords II. Procedure I. Identify the use of the following Password Cracking Tools a. LCP It is designed to help administrators identify and remediate security vulnerabilities that results from the use of weak and/or easily guessed passwords that users use. It is also designed to help administrators recover lost passwords and streamline migration of users to another authentication system. b. Crack It is designed to allow system administrators locate users who may have used weak passwords and are vulnerable to a dictionary attack. c. Access Passview This utility reveals the database password of every password-protected mdb file that was created with the use of Microsoft Access 95/97/2000/XP or with the use of Jet Database Engine 3.0/4.0. It can be used to recover any lost Access Database password. d. MS Access Database Password Decoder It is a program that helps users to recover any lost or forgotten passwords for MS Access database files and user-level passwords that are stored in the workgroup information file. e. Asterisk Logger It is a program that can be used to reveal passwords stored behind asterisks in standard password text-boxes. f. CHAOS Generator It is an application designed to generate passwords of any length and character content. CHAOS Generator will create alphabetic, numeric, alphanumeric or all keyboard characters passwords of user-defined...

Words: 262 - Pages: 2

Premium Essay

E.Coli Transformation

...E.coli Transformation Brooke Rowlett November 26, 2013 BioL 230 Lab Introduction In this experiment we attempted to transform e.coli using a green fluorescent protein plasmid. This green fluorescent protein is naturally found within the bioluminescent jellyfish. The protein can be expressed in both prokaryotic and eukaryotic cells. Normally whenever bacterial cells contain this protein are exposed to long wave UV radiation, they emit a green light. Bacterial cells acquire the glowing ability through the transformation of the bacteria by a plasmid containing the GFP gene. Transformation is the process in which bacteria take up exogenous DNA to acquire to traits (Witucki). The GFP would be our evidence to see whether or not the transformation was successful. Within this experiment E.coli was supposed to be transformed to have the ability of antibiotic resistance. In the experiment E.coli was first transferred into both DNA- and DNA+ microcentrifuge tubes, and then manipulated into competency so that the plasmid can enter into the cells. E.coli is not naturally competent and therefore we tried to manipulate it by exposing it to abrupt heat and cold treatments and through the treatment of the metal cations of chloride salts. The samples were then transferred to Ampicillin positive and negative plates to test for growth. After incubation, if there was any growth on the plates, the plate was placed under a UV light to look for the green light from the protein. We hypothesized...

Words: 1047 - Pages: 5

Free Essay

Babs Enzyme Project

...BABS1201  Group  Enzymes  Project   Group  Protocol  Including  Equipment  and  Reagents  List     Lab  Day:   Lab  Time:   Wednesday     10am  –  1pm       Are  you  in  Lab  G20  (furthest  from  BSB  Student  Office)  or  Lab  G21  (closest  to  BSB  Student  Office)?:   Demonstrator  Name:   Daniel  Winters     Names  of  Group  Members:   Johnny  Nguyen,  Therese  Pham,  Linda  Tang   Name  of  Enzyme  You  are  Investigating:  Amylase   Brief  Background:   Amylase  is  a  digestive  enzyme,  produced  mainly  by  the  salivary  glands  and  the  pancreas,  to  break  down   starch  in  food  into  smaller  carbohydrate  molecules  and  disaccharides  such  as  maltose.  It  can  be  found  in   humans  and  some  other  mammals.  Some  plants  and  bacteria  may  also  produce  amylase.  After  being   broken  down  into  smaller  carbohydrate  molecules,  it  can  be  converted  into  a  monosaccharide  such  as   glucose,  which  fuels  processes  for  organism  function.  There  are  two  variations  of  this  molecule  but  the  ...

Words: 1409 - Pages: 6

Premium Essay

Trying to Join Site

...IT1115 Introduction to Information Technology Syllabus Credit hours: 6.0 Contact/Instructional hours: 70 (50 Theory, 20 Lab) IT1115 Introduction to Information Technology Syllabus COURSE SUMMARY COURSE DESCRIPTION This course explores foundational topics related to information technology. Topics examined include computing devices, hardware, software, operating systems, computer networks, security, and computer programming. Logical problem solving, troubleshooting, and maintenance of computer systems are also introduced. MAJOR INSTRUCTIONAL AREAS 1. Computer History and Fundamentals 2. Hardware 3. Operating Systems 4. Basic Networking 5. Basic Security 6. Software 7. Basic Programming 8. Web Technologies 9. Troubleshooting COURSE LEARNING OBJECTIVES By the end of this course, you should be able to: 1. Identify the evolution of computers and different types of computers. 2. Convert numbers between binary, decimal, and hexadecimal number systems. 3. Explain the purpose, functions, and characteristics of a CPU. 4. Describe the physical components of a computer and various input and output devices, including storage and memory. 5. Describe the function of BIOS and the booting process of a computer. 6. Describe basic operating system architecture, its components, and storage management. © ITT Educational Services, Inc. All Rights Reserved. [2] 6/15/15 IT1115 Introduction to Information Technology Syllabus 7. Describe basic types of computer network topologies and connections...

Words: 12527 - Pages: 51

Premium Essay

Information Security

...JONES & BARTLETT LEARNING INFORMATION SYSTEMS SECURITY & ASSURANCE SERIES LABORATORY MANUAL TO ACCOMPANY Security Strategies in Windows Platforms and Applications 1E REVISED 38542_FMxx.indd i 9/5/12 10:48 AM World Headquarters Jones & Bartlett Learning 5 Wall Street Burlington, MA 01803 978-443-5000 info@jblearning.com www.jblearning.com Jones & Bartlett Learning books and products are available through most bookstores and online booksellers. To contact Jones & Bartlett Learning directly, call 800-832-0034, fax 978-443-8000, or visit our website, www.jblearning.com. Substantial discounts on bulk quantities of Jones & Bartlett Learning publications are available to corporations, professional associations, and other qualified organizations. For details and specific discount information, contact the special sales department at Jones & Bartlett Learning via the above contact information or send an email to specialsales@jblearning.com. Copyright © 2013 by Jones & Bartlett Learning, LLC, an Ascend Learning Company All rights reserved. No part of the material protected by this copyright may be reproduced or utilized in any form, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the copyright owner. The Laboratory Manual to accompany Security Strategies in Windowa Platforms and Applications is an independent publication and has not been authorized, sponsored, or otherwise...

Words: 25969 - Pages: 104

Premium Essay

Ccna 3 Pt Lab Manual

...This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors in the CCNA Exploration: LAN Switching and Wireless course as part of an official Cisco Networking Academy Program. PT Activity 1.2.4: Build a Hierarchical Topology Topology Diagram Learning Objectives • • Add devices to a topology. Connect the devices. Introduction Packet Tracer is integrated throughout this course. You must know how to navigate the Packet Tracer environment to complete this course. Use the tutorials if you need a review of Packet Tracer fundamentals. The tutorials are located in the Packet Tracer Help menu. This activity focuses on building a hierarchical topology, from the core to the distribution and access layers. All contents are Copyright © 1992–2007 Cisco Systems, Inc. All rights reserved. This document is Cisco Public Information. Page 1 of 3 CCNA Exploration LAN Switching and Wireless: LAN Design PT Activity 1.2.4: Build a Hierarchical Topology Task 1: Add Devices to the Topology Step 1. Add the missing distribution layer routers. The routers you need are located in Custom Made Devices. R1 and R3 are 1841 routers. Ctrl-click the 1841 router to add more than one. Press ESC to cancel. R2 is a 2621XM router. Step 2. Add the remaining access layer switches. Following the topology diagram, add nine 2960-24TT switches to complete the rest of the access...

Words: 48601 - Pages: 195