Premium Essay

Comp 274

In:

Submitted By mally1979
Words 625
Pages 3
COMP 274
Week 5 Homework Questions
Answer the following questions:

1. Describe the graphical coordinate system in Java. Where is the origin? What units apply to the x,y coordinates? The horizontal axis is the x coordinate and the vertical axis is the y coordinate. The origin is the upper left corner of the display area. Moving to the right increases the x value, moving down increases the y value. The units are pixels.

2. How would you use the Graphics class to draw a line between 2 specific points? Give an example. public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Line2D lin = new Line2D.Float(5, 30, 380, 30); g2.draw(lin); }

3. How do you specify a particular color to be used as fill when using the Graphics class? g2.setPaint(Color.BLACK);

4. How would you create a SanSerif font of point size 14 that is bold and italic? Give an example. JButton b = new JButton("OK"); b.setFont(new Font("sansserif", Font.BOLD, 32));

5. Given a graphics object g, write a few lines of code to have that graphics object draw a green circle (filled in) that has a diameter of 100 pixels. import java.awt.*; import java.applet.*;

public class FirstApplet extends Applet { public void paint (Graphics g) { g.drawRect(40,20,200,100); g.drawOval(40,20,200,100); }

6. Given a graphics object g, write a few lines of code to draw a red rectangle (not filled in) with its upper left corner at position 25, 25 with a width of 100 and a height of 50. import java.awt.*; import java.applet.Applet; public class redRectangle extends Applet { public void paint(Graphics g) { g.setColor(Color.red); g.drawRect(25,25,100,50); } }

7. What is the paintComponent method? How is it used in

Similar Documents

Free Essay

Comp274 Comp/274 Comp 274 Week 5

...HELPIDO.COM http://helpido.com/comp-274-week-5/ COMP274 COMP/274 COMP 274 WEEK 5 PROGRAMMING ASSIGNMENT ________________________________________ Timer and Mouse Events and Java Graphics Introduction The purpose of this week’s programming assignment is to learn how to deal with events from multiple sources. In addition, we will learn how to use some of Java’s graphics capabilities for drawing shapes in a display area. The programming assignment for this week is to implement a simple paddle ball game. Paddle Ball Game Overview The paddle ball game is a simplification of the Pong game. In the Pong game, a ball is moving around the display, bouncing off walls. The player moves a paddle in one dimension, trying to hit the ball whenever possible. If the ball hits the paddle, it bounces off and continues on its way. If the paddle misses the ball, the ball goes off the end of the display area and the player loses a point. In our paddle ball game, the ball moves around the display, bouncing off walls just as in the Pong game. The player controls a paddle trying to hit the ball just like in the Pong game. If the ball hits the paddle, it bounces off and continues on its way. The main difference in our game is that if the player misses the ball, the ball simply bounces off the wall behind the paddle and continues to travel. There is no scoring in this game. Object Oriented Design If we analyze the game description we can see there are several different objects...

Words: 2412 - Pages: 10

Free Essay

Comp274 Comp/274 Comp 274 Week 5

...HELPIDO.COM http://helpido.com/comp-274-week-5/ COMP274 COMP/274 COMP 274 WEEK 5 PROGRAMMING ASSIGNMENT ________________________________________ Timer and Mouse Events and Java Graphics Introduction The purpose of this week’s programming assignment is to learn how to deal with events from multiple sources. In addition, we will learn how to use some of Java’s graphics capabilities for drawing shapes in a display area. The programming assignment for this week is to implement a simple paddle ball game. Paddle Ball Game Overview The paddle ball game is a simplification of the Pong game. In the Pong game, a ball is moving around the display, bouncing off walls. The player moves a paddle in one dimension, trying to hit the ball whenever possible. If the ball hits the paddle, it bounces off and continues on its way. If the paddle misses the ball, the ball goes off the end of the display area and the player loses a point. In our paddle ball game, the ball moves around the display, bouncing off walls just as in the Pong game. The player controls a paddle trying to hit the ball just like in the Pong game. If the ball hits the paddle, it bounces off and continues on its way. The main difference in our game is that if the player misses the ball, the ball simply bounces off the wall behind the paddle and continues to travel. There is no scoring in this game. Object Oriented Design If we analyze the game description we can see there are several different objects...

Words: 2412 - Pages: 10

Premium Essay

Cis Web Gaming

...COMP-274 Week 1 Homework Assignment Week 1 Reading: Lecture Java and C++ Similarities Chapter 1: Introduction to Computers, Programs, and Java Sections 1.5, 1.6, 1.7, 1.8, 1.9 Chapter 2: Elementary Programming Sections 2.3, 2.7, 2.11, 2.13, 2,15, 2.16, 2.18 Chapter 3: Selections Sections 3.16, 3.17, 3.18, 3.19 Chapter 4: Loops Section 4.10 Chapter 5: Methods Sections 5.2, 5.3, 5.8, 5.9, 5.10, 5.11 Chapter 6: Single Dimensional Arrays Sections 6.1, 6.2, 6.5, 6.6 Create a Word document containing the answers to all the problems given below. 1. What is the Java source filename extension? What is the Java bytecode filename extension? Java Source filename extension is .java Java Bytecode will be stored in .class filename 2. Write a Java statement to display the string “The value is 100” to a user in a plain dialog box. import javax.swing.JOptionPane; public class ValueMessage {     public static void main (String[] args)     {       JOptionPane.showMessageDialog(null, “The value is 100”);     } } 3. What is the command you would use to compile the file Addition.java? Javac 4. What is the command you would use to execute the Addition class? Java 5. What does a Java class contain that identifies it as a Java application? A Main Method public static void main(String args[]) 6. Write a Java...

Words: 734 - Pages: 3

Premium Essay

Beximco Pharma

...Balance Sheet for Beximco Pharmaceuticals Ltd GDR (BXP) from Morn... http://financials.morningstar.com/balance-sheet/bs.html?t=BXP®ion=gbr 1 of 3 Log In Premium Company Site Company News Welcome! Membership Home Portfolio Nasdaq 4756.22 27.55(0.58%) Stocks Bonds S&P 500 2031.54 15.61(0.77%) Funds ETFs DJIA 17396.37 144.84(0.84%) CEF Markets Gold 1266.10 36.80(2.99%) Tools Real Life Finance Discuss Light Crude 39.77 1.31(3.41%) Advertisement Beximco Pharmaceuticals Ltd GDR BXP Add to Portfolio Quote Chart Income Statement Statement Type Annual Get E-mail Alerts Stock Analysis Print This Page Performance Balance Sheet Data Type As of Reported PDF Report Key Ratios 10 Things to Start Doing Data Question Financials Valuation Insiders Ownership Filings Bonds Cash Flow Period 5 Years Show Report Dates Data Scroll View Rounding Export Ascending 3/17/2016 9:24 PM Balance Sheet for Beximco Pharmaceuticals Ltd GDR (BXP) from Morn... http://financials.morningstar.com/balance-sheet/bs.html?t=BXP®ion=gbr 2 of 3 Fiscal year ends in December 2010-12 2011-12 2012-12 2013-12 2014-12 21,372 23,033 24,590 27,471 29,001 6,192 7,149 8,197 8,903 8,366 Cash 2,331 2,712 3,240 3,622 2,697 Cash and cash equivale... 1,471 519 553 596 222 859 2,193 2,687 3,026 2,475 BDT in Million except per share data Assets Current assets Short-term investments 2,331 2,712 3,240 3,622 2,697 Receivables Total cash...

Words: 946 - Pages: 4

Premium Essay

The Commodification of Free Speech

...Benjamin Marchman English 122 Cathryn Lawson The Value of Online Privacy Since the September 11th terrorist attacks the United Sates and the world at large has officially entered into an age of counter-terrorism. While the more obvious aspects of this effort against violent extremism, which violate human and constitutional rights, such as drone strikes, waterboarding, and black prison sites, are specifically targeted toward a specific population, it is the subtler aspects of mass surveillance and corporate and governmental intrusion of privacy which present an overwhelming threat to human rights and quality of life. As has been made clear by recent revelations of the scope and depth of these intrusions, internet users specifically have many reasons to suspect that private information entered online is vulnerable to un-ethical intrusions by third parties. However, many groups and individuals have come together to bring resolution to the issue of personal privacy and national security. According to article 12 of the Universal Declaration of Human Rights, no one shall be subjected to arbitrary interference with his privacy, family, home or correspondence, or to attacks upon his honor and reputation (Lachmayer 749). However, the more subtle aspects of the new counter-terrorism age include a heightened amount of internet surveillance, video surveillance of public spaces, electronic eavesdropping, and data retention. Additionally governments have access to bank accounts,...

Words: 2685 - Pages: 11

Premium Essay

Case Abb

...Case 1 ABB Electric Segmentation Group 7C Context ¡  ABB is a producer of electrical equipment. ¡  ABB established a new marketing strategy based on analytical techniques (MKIS)to improve its results. ¡  ABB management segmented its marketing into 4 categories using Choice Modeling : Loyal, Competitive, Switchable and Lost. ¡  ABB has been given a budget for a supplementary direct marketing campaign aimed at 20% of the companies in the region composed of 3 districts. Outline 1.  Customer targeting with limited data 2.  Choice-based model 3.  Limits of the model and suggestions I. Customer targeting with limited data •  Introduction to the market •  Limited data targeting : no geographical distinction •  Limited data targeting : customers targeted The Market ¡  Market size : $ 102 759 ¡  ABB’s share : $ 21 524 ¡  4 mains actors in the market : ¡  ¡  ¡  ¡  ABB GE Westinghouse Edison Edison# 26%# Market'distribu-on' ABB# 21%# ¡  88 companies ¡  Goal : Attract 20% of the customers (i.e. 18 companies) Wes-ngho use# 29%# GE# 24%# Limited data targeting – No geographical distinction ¡  The best targets seem to be district 2 (customers of Westinghouse and Edison) and district 3 (customers of GE) as they represent the biggest market share when combined. ¡  However, all districts present a high heterogeneity of their clients (from $226 to $10997 for the district 2). ¡  Objective : increase market share by targeting “big whales” i...

Words: 1399 - Pages: 6

Premium Essay

Management

...Unclassified Organisation de Coopération et de Développement Économiques Organisation for Economic Co-operation and Development DAF/COMP(2014)14 06-Jun-2014 ___________________________________________________________________________________________ English - Or. English DIRECTORATE FOR FINANCIAL AND ENTERPRISE AFFAIRS COMPETITION COMMITTEE DAF/COMP(2014)14 Unclassified AIRLINE COMPETITION -- Background Paper by the Secretariat -18-19 June 2014 This document was prepared by the OECD Secretariat to serve as a background note for Item IX at the 121st meeting of OECD Competition Committee on 18-19 June 2014. The opinions expressed and arguments employed herein do not necessarily reflect the official views of the Organisation or of the governments of its member countries. More documents related to this discussion can be found at http://www.oecd.org/daf/competition/airlinecompetition.htm. English - Or. English JT03358883 Complete document available on OLIS in its original format This document and any map included herein are without prejudice to the status of or sovereignty over any territory, to the delimitation of international frontiers and boundaries and to the name of any territory, city or area. DAF/COMP(2014)14 TABLE OF CONTENTS Introduction ................................................................................................................................................. 3 1. Features of the airline industry .............................

Words: 29874 - Pages: 120

Premium Essay

Operation Strategy Quality Measures

...The Role and Measurement of Quality in Competition Analysis 2013 The OECD Competition Committee discussed the role and measurement of quality in competition analysis in June 2013. This document contains an executive summary of that debate and the documents from the meeting: an analytical note by the OECD staff and written submissions: Australia, Canada, Chile, the European Union, Indonesia, Japan, Mexico, Portugal, United Kingdom, Ukraine, United States and BIAC. A note by Theodore Voorhees Jr. as well as a detailed summary of the discussion are also included. Competition policy is just as concerned with quality as it is with prices. While the importance of quality is undisputed and issues about quality are mentioned pervasively in competition agency guidelines and court decisions, there is no widely-agreed framework for analysing it which often renders its treatment superficial. There are a number of reasons why in practice, courts and competition authorities rarely analyse quality effects as rigorously as they analyse price effects. First, quality is a subjective concept and therefore much harder to define and measure than prices. In addition, microeconomic theory offers little help in predicting how changes in the level of competition in a market will affect quality and it is usually up to empirical analysis to determine how quality will change in response to varying degrees of competition in the context of particular markets. Given difficulties in terms of the evaluation...

Words: 125933 - Pages: 504

Free Essay

Light-Induced Rod and Cone Cell Death Andregeneration in the Adult Albino Zebrafish (Daniorerio) Retina

...Light-Induced Rod and Cone Cell Death and Regeneration in the Adult albino Zebrafish (Danio rerio) Retina Thomas S. Vihtelic and David R. Hyde Department of Biological Sciences, University of Notre Dame, Notre Dame, Indiana 46556-0369 Received 24 January 2000; accepted 25 April 2000 ABSTRACT: Light-induced photoreceptor cell degeneration has been studied in several species, but not extensively in the teleost fish. Furthermore, the continual production of rods and cones throughout the teleost’s life may result in regeneration of lost rods and cones. We exposed adult albino zebrafish to 7 days of constant darkness, followed by 7 days of constant 8000 lux light, followed by 28 days of recovery in a 14-h light:10-h dark cycle. We characterized the resulting photoreceptor layer cell death and subsequent regeneration using immunohistochemistry and light microscopy. Within the first 24 h of constant light, the zebrafish retina exhibited widespread rod and cone cell apoptosis. High levels of cell proliferation within the inner nuclear layer (INL) were observed within the first 3 days of Light has been an effective and popular environmental method to experimentally induce photoreceptor cell degeneration. The light treatment can irreversibly cause photoreceptor cell loss through apoptosis (Shahinfar et al., 1991; Li et al., 1996). Factors such as light intensity and exposure duration, length of dark adaptation before light exposure, and ocular pigmentation influence the retinal damage in mice...

Words: 11863 - Pages: 48

Free Essay

Vías de Transporte

...MEMORIA DE CÁLCULO CARRETERA SAN GABRIEL-MINATITLÁN VÍAS TERRESTRES RODRIGO AVILA KHOURY Contenido Tipo de camino 4 Geotecnia 5 Medio Ambiente 7 Adecuación de los estándares 8 Estándares geométricos 8 Pendiente Gobernadora 10 Alineamiento Horizontal 11 Tangente 11 Curva simple 11 Grado de curvatura 13 Radio de curva 13 Longitud de curva 13 Curvas de transición 13 Espiral 14 Tipo de curvas 16 Rumbo 18 Registro de trazo 23 Sección transversal 23 Obras de drenaje 29 Alineamiento Vertical 36 Tangentes 36 Pendiente gobernadora 37 Pendiente máxima 37 Longitud critica de una tangente del alineamiento vertical. 37 Curvas verticales 37 Rasante 37 Secciones transversales 41 Corte 41 Terraplén 41 Balcón 41 Áreas 41 Curva Masa 48 Costos 55 Trazo definitivo de carretera 56 Proceso constructivo 57 Tipo de camino El proyecto presentado a continuación es acerca del tramo 20+300 a 21+550 de la carretera San Gabriel-Minatitlán. Esta carretera es de suma importancia, ya que pasa por una parte importante del país, y une diferentes estados como Michoacán, Jalisco, Edo de México, Hidalgo, Veracruz, entre otros. Todos los cálculos presentados a continuación fueron basados en las normas de SCT, y se consideró que es una carretera de tipo C. Estas normas establecen los requisitos mínimos y parámetros a considerar. La utilidad principal de este camino, es conectar a los diferentes poblados y de esta forma mejorar su comunicación...

Words: 8968 - Pages: 36

Free Essay

Roadmap

...International Series in Quantitative Marketing Min Ding Jehoshua Eliashberg Stefan Stremersch Editors Innovation and Marketing in the Pharmaceutical Industry Emerging Practices, Research, and Policies Chapter 3 Portfolio Management in New Drug Development Min Ding, Songting Dong, Jehoshua Eliashberg, and Arun Gopalakrishnan Abstract The pharmaceutical industry leads all industries in terms of R&D spend. Portfolio management in new drug development is extremely challenging due to long drug development cycles and high probabilities of failure. In 2010, a pharmaceutical company like GlaxoSmithKline (GSK) spent over USD 6 billion in R&D expenditure and managed a total of 147 R&D projects across 13 therapeutic areas in different stages of development. There are a lot of challenges in deciding on how to allocate resources to these projects in order to achieve the maximum returns. For example, how to evaluate the value and risk of each project, how to choose new projects for both short-term cash flow and long-term development, how to decide which projects to prioritize and which projects to remove from the portfolio, how to design drug development unit and incentive schemes to maximize the likelihood of success, and so forth. This chapter reviews both practice and the state-of-the-art research and summarizes the latest insights from both industry and academia. For a manager, it provides a guide to the tools they need in portfolio management in the new drug development...

Words: 16001 - Pages: 65

Free Essay

Economic Nexus in Washington State

...2/5/2012 ECONOMIC NEXUS IN WASHINGTON STATE: DEFINING SUBSTANTIAL NEXUS Armikka R. Bryant* I. INTRODUCTION This Article explores the evolving framework of nexus and examines the constitutional constraints imposed on states’ tax jurisdiction and how states overcome those limitations. In 2010, the Washington State Legislature declared that out-of-state businesses with no physical presence in Washington were earning significant income from Washington residents by providing services or collecting royalties on the use of intangible property in the state.1 The Legislature also determined that, although these out-of-state businesses did not have a physical presence in the state and were not paying their fair share of Washington State taxes, they were nonetheless receiving the following significant benefits provided by the state: • Laws providing protection of business interests or regulating consumer credit; • Access to courts and judicial process to enforce business rights, including debt collection and intellectual property rights; • An orderly and regulated marketplace; and • Police and fire protection and a transportation system benefiting in-state agents and other representatives of out-of-state businesses.2 * Armikka R. Bryant, Tax Policy Counsel, Washington State Department of Revenue; J.D., 2001, The University of Iowa; LL.M. (Taxation), 2004, The University of Washington; B.A., 1997, The University of Michigan; member of Washington State Bar. I would...

Words: 13223 - Pages: 53

Premium Essay

Tesla

...Equity Research Industrials | U.S. Autos & Auto Parts 12 February 2015 Tesla Motors Inc. Another reminder of challenges ahead EQUAL WEIGHT Stock Rating Unchanged NEUTRAL Industry View 4Q print validated concern that crossing the chasm is tougher than it looks: Last week we caught the ire of Tesla bulls by lowering our estimates based on concerns about production delays and rising opex and capex (see “Crossing the chasm is tougher than it looks”). The 4Q print validated many of those concerns. Behind an EPS loss of 13c vs. consensus +30c were several soft spots – Tesla missed 4Q deliveries and guided softly for 1Q’15, ZEV credits artificially boosted results, opex grew faster than expected, and capex was guided well ahead of our conservative model. The result reinforces that Tesla’s push to become a mass market OEM is much harder than it looks. We reiterate our EW rating and remain cautious on the stock near-term. Unchanged USD 190.00 Price Target lowered -5% from USD 200.00 Price (11-Feb-2015) USD 212.80 Potential Upside/Downside -11% Tickers TSLA 26681 Shares Outstanding (mn) Don’t get caught up with ambitious mid/long-term targets…: Despite the weak quarter, there was enough to keep the die-hard bulls interested. Our take - don’t get caught up in it. On the demand side, Musk noted Tesla could reach its ‘15 S/X delivery guide of 55k even ex. China, and has a “secret weapon” which could be deployed later ...

Words: 12089 - Pages: 49

Premium Essay

Holder and Holder in Due Course

...1. Scope It is now fairly well-settled that no person can sue on a negotiable instrument unless he is named therein as the payee or unless he becomes entitled to it as indorsee or becomes the bearer of an instrument payable to bearer. In the Full Bench case reported in Subba Narayana Vathiyar v. Ramaswami Aiyar,1 it has been held that in a suit on a negotiable instrument by the payee or indorsee, it is not open to the defendant to plead that the plaintiff is a mere benamidar not entitled to payment with a view to show that the note has been discharged by payment to real owner. Again in the Full Bench decision of the Patna High Court in Bacha Prasad v. Janaki,2 it has been held that a person who is not a holder of a negotiable instrument cannot maintain a suit for recovery of money due under it even though holder is admittedly the benamidar and is impleaded in the suit. In the said decision, it has also been held that "a beneficiary cannot be called a holder of the instrument and payment to him cannot discharge the maker thereof unless the case falls under section 82(c) of the Act". So also, it has been held in the decision reported in Subharaya v. Abiram,3 that a beneficiary does not become a holder of the instrument even upon getting a declaration that he is the beneficial owner and the payee is only a benamidar. In this connection it has to be noted that Allahabad and Rajasthan High Courts have taken a slightly different view and held that in certain cases a beneficiary may...

Words: 16119 - Pages: 65

Premium Essay

Abc Analysis

...RightNow PAGE 3 LESSONS IN CONTACT CENTER LEADERSHIP eGain PAGE 6 DOING MORE WITH LESS IN CUSTOMER SERVICE: Strategies and Best Practices Kana PAGE 7 HOW TO MAKE EVERY CUSTOMER CONVERSATION INTELLIGENT Oracle PAGE 8 TRANSFORMING SERVICE IN THE AGE OF THE CUSTOMER Verint PAGE 9 THE POWER OF WHY Astute Solutions PAGE 10 ENSURING CONSISTENT, ACCURATE AND TIMELY INFORMATION DELIVERY ACROSS ALL CHANNELS SYKES PAGE 11 INSIGHT TO CUSTOMER LOYALTY Using Customer Support to Observe Customers in Motion Convergys PAGE 12 LISTENING TO CUSTOMERS AND PROFITING FROM THEIR ADVICE Best Practices in VPI Voice Print Int’l PAGE 13 Contact Center FIVE PROVEN WAYS TO PROACTIVELY DELIVER AN EXCEPTIONAL CUSTOMER EXPERIENCE SOLUTIONS Produced by: CRM Media, LLC Autonomy etalk PAGE 14 UNSTRUCTURED AND UNDISCOVERED: Enabling the Intelligent Contact Center to Tap into a Hidden Wealth of Information 2 April 2007 Sponsored Content CRM magazine Best Practices Series: Contact Centers... The Heart (and Eyes and Ears) of CRM Multichannel contact centers are at the heart of one of the most exciting transformations in the way organizations communicate with their customers. It is this collaboration between people, process, and technology that promises to bring the best customer service to users, while enabling a crucial feedback channel to host organizations. We’re all familiar with the reasons why superior customer...

Words: 11002 - Pages: 45