...LAB EXERCISE 1: READ FROM URL URLReader.java import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL yahoo = new URL("http://www.lelong.com/"); BufferedReader in = new BufferedReader( new InputStreamReader( yahoo.openStream())); String inputLine; for ( int i =0;(inputLine = in.readLine()) != null; i++){ System.out.println(inputLine);} in.close(); } } LAB EXERCISE 2: Echo Client EchoClient .java import java.io.*; import java.net.*; public class EchoClient { public static void main(String[] args) { try { Socket s = new Socket("127.0.0.1", 9999); BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter w = new PrintWriter(s.getOutputStream(), true); BufferedReader con = new BufferedReader(new InputStreamReader(System.in)); String line; do { line = r.readLine(); if ( line != null ) System.out.println(line); line = con.readLine(); w.println(line); } while ( !line.trim().equals("bye") ); } catch (Exception err) { System.err.println(err); } } } LAB EXERCISE 3:MULTI THREADS SimpleThreads.java public class SimpleThreads { //Display a message, preceded by the name of the current thread static void threadMessage(String message) { String threadName = Thread.currentThread().getName(); System...
Words: 1219 - Pages: 5
...IT110-1302A-06 Introduction to Programming Hockey Performance 5/6/2013 TABLE OF CONTENTS Contents TITLE PAGE 1 TABLE OF CONTENTS 2 Week 1: Project Outline 3 Week 1: Project Outline 4 Week 1: Use Case Diagrams 5 Week 1: Class Diagram 6 Week 2: Java Fundamental 7 Week 2: Java Fundamental 8 Week 3: Java Control Structures 9 Week 3: Java Control Structures 10 Week 4: Error Handling and File Input/Output 11 Week 4: Error Handling and File Input/Output 13 Week 4: Error Handling and File Input/Output 14 Week 4: Error Handling and File Input/Output 15 Week 4: Error Handling and File Input/Output 16 Week 4: Error Handling and File Input/Output 17 Week 4: Error Handling and File Input/Output 18 Week 4: Error Handling and File Input/Output 19 Week 4: Error Handling and File Input/Output 20 Week 5: Final Application Design & Screenshots 21 Week 5: Final Application Design & Screenshots 22 Week 5: Final Application Design & Screenshots 23 Week 5: Final Application Design & Screenshots 24 Week 5: Final Application Design & Screenshots 25 Week 5: Final Application Design & Screenshots 26 Week 5: Final Application Design & Screenshots 27 Week 5: Final Application Design & Screenshots 28 Week 5: Final Application Design & Screenshots 29 REFERENCE: An Introduction to Java Programming and Object-Oriented Application Development 29 ISBN-13: 9780619217464 29 Author(s): Johnson 29 Week 1: Project Outline ...
Words: 773 - Pages: 4
...THE WAJA CONCEPT Proton’s Waja was conceptualised as the basis for the company’s advancement from assembly and minor re-engineering to the position of full design and manufacture. It was designed as a competitive product for global consumption of the 21st Century with an attractive design targeting mature, dynamic and multi-cultural markets. The Proton Waja boasts superlative handling dynamics together with compliant ride and enormous body strength and integrity. The new Proton broadens the company’s product line-up joining the cult-status Satria GTi as well as the price-leading Persona and Satria models. Waja is the result of intensive engineering work by Proton R & D in Malaysia and Lotus Engineering in Hethel, England. The blend of technologies from Malaysia and England has produced a car that is at once safe, secure, strong and precise, a car worthy of comparison with the world’s best mid-size sedans. KEY TECHNICAL FEATURES OF THE WAJA • Lotus ride and handling • Unique modular integration • A stronger more rigid body • High levels of primary and secondary safety • Significant NVH reductions STYLING The Proton Waja benefits from inspired styling and boasts clean and stylish lines born in the company’s design studio at Shah Alam. The Waja has a personality all its own and has adopted clean smooth lines in a classic three box design on a platform which will be used as the basis for other models in the future. The styling has been aimed...
Words: 1378 - Pages: 6
...public abstract class Animal extends Organism { boolean ateThisTurn; boolean wantsToMove; public void wasIJustFed(boolean ateOrNot) { if (ateOrNot == true) { ateThisTurn = true; } else { ateThisTurn = false; } } public void resetHunger() { ateThisTurn = false; } public void wasIJustMoved(boolean movedOrNot) { if (movedOrNot) { wantsToMove = false; } else { wantsToMove = true; } } public String toString() { String deadOrAlive = new String(); if (isAlive) { deadOrAlive = "A Living "; } else { deadOrAlive = "A Dead "; } return "[" + deadOrAlive + organismType + ": " + currentHP + "/" + maxHP + " | " + lastReproduced + "/" + reproduceEvery + " - ateThisTurn = " + ateThisTurn + "\n"; } public boolean justAte() { return ateThisTurn; } public boolean moveThisTurn() { return wantsToMove && isAlive; } public boolean isReadyToReproduce() { return super.isReadyToReproduce() && maxHP == currentHP && ateThisTurn && isAlive; } public boolean isBurning() { return false; } } import java.awt.*; import java.util.ArrayList; public class Breeder { public Breeder() { } public static void breed(Organism breedingOrganism, WorldWorker environment, Point pointHolder)...
Words: 2671 - Pages: 11
...Introduction Article 15(4) was inserted into the Constitution by way of amendment and wasn’t a clause which was present in the Constitution, since it came into being. This amendment gave the executive powers to make any special provisions for the advancement of any socially and educationally backward classes of citizens or for the Schedule Castes and Schedule Tribes. This provision was considered necessary by the legislature as India gained independence and a democratic form of Government came into being, the need to uplift the down-trodden was felt. Reservation were to be implemented initially for only 10 years but have being continuing till now. Over the years the extent to which reservations should be allowed has been a matter of great controversy and has been discussed in various cases. The present condition is that reservations in general should not exceed 50%. But this was not always the position. Since Article 15(4) permits discrimination in reverse by reserving seats in educational institutions, the extent of such reservation assumes great importance for the citizen, for the public generally and for the State. An instructive illustration of such appointments to unreserved and reserved posts is furnished by the facts of T. Devadasan v. Union of India and Anr. Out of 45 appointments to be made, 16 were made from unreserved seats and 29 from candidates belonging to the Schedule Castes and Tribes. The petitioner complained that although he had obtained 61 per cent marks...
Words: 1443 - Pages: 6
...Question 1: (5 marks) Write a program in Java using linked list to manage information about persons. Variables used to store information about a person are: • name - the name of a person (character string). • age - the age of a person (integer value). You should write the MyList class, which is a linked list data structure to store person information. The following functions should be included in the MyList class: • void addLast(String xName, int xAge) - check if the first letter of xName is not 'B' (i.e. xName.charAt(0) != 'B') then add new person with name=xName, age=xAge to the end of the list. • void addFirst(String xName, int xAge) - check if the first letter of xName is not 'B' then add new person with name=xName, age=xAge to the begining of the list. • void addMany(String [] a, int [] b) - this function is given. • void ftraverse(RandomAccessFile f) throws Exception - display all nodes in the file f in format: (name, age). This function is given. • void f1() – Test addLast function. You do not need to edit this function. Your task is to complete the function addLast(String xName, int xAge) function only. With the given data, the content of f1.txt must be the following: (A0,9) (A7,13) (A5,7) (A3,11) (A4,9) (A2,12) (A6,5) (A1,6) • void f2() – Test addFirst function. You do not need to edit this function. Your task is to complete the function addFirst(String xName, int xAge) function only. With the given data, the content of f2.txt must be the following: ...
Words: 349 - Pages: 2
...MIPS Reference Data Card (“Green Card”) 1. Pull along perforation to separate card 2. Fold bottom side (columns 3 and 4) together M I P S Reference Data Add Immediate Add Unsigned And And Immediate Branch On Equal addi 1 CORE INSTRUCTION SET FORNAME, MNEMONIC MAT OPERATION (in Verilog) add Add R R[rd] = R[rs] + R[rt] I I R[rt] = R[rs] + SignExtImm R[rt] = R[rs] + SignExtImm Add Imm. Unsigned addiu addu and andi beq OPCODE / FUNCT (Hex) (1) 0 / 20hex (1,2) (2) 8hex 9hex 0 / 21hex 0 / 24hex (3) (4) (4) (5) (5) chex 4hex 5hex 2hex 3hex 0 / 08hex (2) (2) (2,7) (2) 24hex 25hex 30hex fhex 23hex 0 / 27hex 0 / 25hex (3) dhex 0 / 2ahex R R[rd] = R[rs] + R[rt] R R[rd] = R[rs] & R[rt] I I I J J R[rt] = R[rs] & ZeroExtImm if(R[rs]==R[rt]) PC=PC+4+BranchAddr if(R[rs]!=R[rt]) PC=PC+4+BranchAddr PC=JumpAddr R[31]=PC+8;PC=JumpAddr Branch On Not Equal bne Jump Jump And Link Jump Register j jal jr Load Byte Unsigned lbu Load Halfword Unsigned Load Linked Load Upper Imm. Load Word Nor Or Or Immediate Set Less Than lhu ll lui lw nor or ori slt R PC=R[rs] R[rt]={24’b0,M[R[rs] I +SignExtImm](7:0)} R[rt]={16’b0,M[R[rs] I +SignExtImm](15:0)} I R[rt] = M[R[rs]+SignExtImm] I I R[rt] = {imm, 16’b0} R[rt] = M[R[rs]+SignExtImm] R R[rd] = ~ (R[rs] | R[rt]) R R[rd] = R[rs] | R[rt] I I R[rt] = R[rs] | ZeroExtImm R R[rd] = (R[rs] < R[rt]) ? 1 : 0 OPCODE / FMT /FT FOR/ FUNCT NAME, MNEMONIC MAT OPERATION (Hex) bc1t FI if(FPcond)PC=PC+4+BranchAddr (4) 11/8/1/-Branch On FP True...
Words: 2042 - Pages: 9
...THE POWER LINE POLES If you were in the position of Gordon Yarrow how would you deal with the bid exceptions requested? If I was Mr. Yarrow, I would request Henry Nelson Co. that several pre-award meetings are held to discuss the exceptions made with the goal of setting final agreements on these exceptions prior contracting the services. I would also make sure that these discussions are recorded as minutes of the meetings so that the document(s) can become an integral part of Henry Nelson’s quote and eventually included in the contract agreement. With regards to each of the exceptions requested (Exhibit 2), my comments are: • Exception 1: To handle this exception, Moren should request Henry Nelson and for that matter all bidders, to include in their quote a Jobsite delivery. Although most of the companies in the US are more familiar with the UCC transportation terms, Moren should request that the latest version of Incoterms (developed by the ICC) should be used as the applicable transportation terms of the contract. By enforcing the use of Incoterms, Moren may even specify that the quoted terms should be DDP-Jobsite which would indicate Henry Nelson and all other bidders that the supplier “must” carry the responsibility and risk of delivering the equipment to the jobsite by the requested date. With this in mind, Henry Nelson and other bidders should include as part of their cost estimate the costs for using DDP-Jobsite delivery terms. This way, the sales price to Moren is...
Words: 913 - Pages: 4
...|FRONT SHEET FOR ASSESSMENT fORM & FEEDBACK TO LEARNER(HND) | |ورقة الغلاف لنموذج ورقة العمل ونتائج المتدرب | |BTEC High National Diploma in { } | |Diploma in Programming Technology دبلوم تقنيه البرمجة | |HND Computing (software development) | | | |Student Name | |اسم المتدرب | | | | ...
Words: 1682 - Pages: 7
...Standard Operating Procedure
Global Demand Generation
|Document Identification Number (For this Document) : BIRLASOFT/SOP TPL/SoP Template |
|Document Identification Number : BIRLASOFT/SOP
Words: 1446 - Pages: 6
...//Example reads in employee data from user //data is not stored in an Employee object but is written into files using //Formatter //PrintWriter //BufferedWriter import java.io.FileWriter; import java.io.BufferedWriter; import java.io.PrintWriter; import java.io.File; import java.util.Formatter; import java.util.Scanner; class FileWriterDemo { public void buffEmployeeFileWriter() throws Exception { String fName; String lName; int id; boolean quit = false; boolean response = true; Scanner console = new Scanner(System.in); Scanner input = new Scanner(System.in); Formatter output = new Formatter("EmployeeFormatter.txt"); //opens the file for editing FileWriter file = new FileWriter("EmployeePrintWriter.txt"); PrintWriter print = new PrintWriter(file); //turn on append flag for EmployeeBufferedFileWriter.txt FileWriter fwriter2 = new FileWriter(new File("EmployeeBufferedFileWriter.txt"), true); BufferedWriter bfw = new BufferedWriter(fwriter2); try { while (quit != response) { System.out.print("Enter Employee First Name:\n"); fName = input.next(); System.out.print("Enter Employee Last Name:\n"); lName = input.next(); System.out.print("Enter Employee id:\n"); id = input.nextInt(); //Example using Formatter ...
Words: 334 - Pages: 2
...Java Programming, Second Edition Chapter Thirteen Understanding Swing Components In this chapter, you will: • • • • • Use the JFrame class Extend the JFrame class Use the JPanel class Understand Swing event listeners Use the JCheckBox class • Use the ButtonGroup class • Use the JComboBox class • Create JScrollPanes Using the JFrame Class GUI Components • Insert the import statement import javax.swing.*; to take advantage of the Swing GUI components and their methods • Also called widgets, which stands for windows gadgets • Within the awt package, components are defined in the Component class • When you use components in a Java program, you usually place them in containers Using the JFrame Class • Container- Type of component that holds other components so that you can treat a group of several components as a single entity – Usually takes the form of a window – Defined in the Container class Using the JFrame • The JFrame class is a subclass of the awt Component class • The JFrame is the best container option for hosting Java applications • The setSize() method allows you to set the physical size of a JFrame • The setVisible() method makes the JFrame component visible or invisible • Create a JFrame so that you can place other objects within it for display using a JPanel Using the JFrame • The JFrame class has four constructors – JFrame() constructs a new frame that is initially invisible – JFrame(GraphicsConfiguration gc) creates a JFrame in the specified...
Words: 2413 - Pages: 10
... Improvements and Operation Of the Damper Dynamometer Andrew Chau 20264212 Michael Li 10758152 Tiong Kun Ooi 20256339 School of Mechanical Engineering, University of Western Australia Supervisor: Lynn O. Kirkham School of Mechanical Engineering, University of Western Australia MECH3402 Final Report School of Mechanical Engineering University of Western Australia Submitted: October 16th, 2009 Page 1 Andrew Chau, 20264212 Michael Li, 10758152 Tiong Kun Ooi, 20256339 Improvements and Operation of the Damper Dynamometer Project Summary Dampers, also known as shock absorbers, are an integral part of a motor vehicle, especially vehicles used in motorsports. The use of different dampers will inevitably affect the handling and stability of a race car as different dampers will have different characteristics and therefore, the dissipation of kinetic energy in the springs will be different. An onsite damper dynamometer will allow UWAM, University of Western Australia Motorsport team, to readily test their dampers to determine their characteristics and also tune them to their desired properties. A damper dynamometer has been manufactured and a data acquisition software, DAQ, already written by previous years projects. The purpose of this project will be to finalise the damper dynamometer. The original scope of the project was to implement safety measures for the damper dynamometer, determine the robustness of the dynamometer, make adjustments so that the dynamometer...
Words: 19945 - Pages: 80
...Attendance & Contribution: • Everyone should contribute to the assignment on daily basis and inform of any issue if there is any exception. • Participate in decisions about group planning, assignments, etc. • If one cannot contribute for whatever reason, please notify in a timely manner. • Participate is must at least three times weekly if discussion is required. Assignment Submission: • Meet assignment deadlines agreed to by the team to allow for final submission on time. • Due date for individual contributions should be set as Friday by noon for each team assignment- giving team lead ample time to compile and submit the project by Sunday. • We should be able to target the submission timeline a day before so that we have enough time to react to any contingency. Team work: • We should work together as a team to deliver the assignment and utilize the strengths of each other. • Make sure that we are unified in the final product. • Be open and willing to do one’s part Weekly Meetings: • A weekly meeting should be held so that the defining of roles for each assignment can be done. • We should meet weekly once in the begging of assignment no later than Wednesday to define roles, assigning a team lead and assignment delivery structure. • Stay in contact with team members via forum or email at least 3 times weekly. • Communicate fairness issues openly and professionally Exceptions: • Team lead and team member should be notified immediately if there is...
Words: 381 - Pages: 2
...software to be perfect. This means no errors! Since we’re human, we can only do our best. It’s when these errors occur, how they are dealt with, error or exception handling. Understanding each type will go a long way when client acceptance testing begins. Errors are problems in program operations usually caused because the code isn’t written correctly or a problem occurred that wasn’t addressed during the design process. According to the Board, the term exception is a reclassification of errors into a category of errors that can occur in a program but can be handled in a way that allows the program to continue operation.(Editorial Board, 2014) Dealing with errors in a well-defined way allows programmers to write code to handle errors. This is exception handling. There are pros and cons for using error and exception handling. Exception handling enables normal code to be written and to deal with the exceptional cases code elsewhere. It also provides the means to separate the details of what to do when something out of the ordinary happens from the main logic of a program. A second advantage of exceptions is the ability to propagate error reporting up the call stack of methods which allows grouping and differentiating error type objects. In traditional programming, error detection, reporting, and handling often leads to confusing code. This presents disadvantages because you lose compile time support, the calling method must take care is testing all possible return values...
Words: 401 - Pages: 2