Preview

JAVA LESSON 6

Better Essays
Open Document
Open Document
1293 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
JAVA LESSON 6
6: Design, Debugging,

Interfaces

6.092: Introduction to Java

Assignment 5: main()
Programs start at a main() method, but many classes can have main() public class SimpleDraw {
/* ... stuff ... */ public static void main(String args[]) {
SimpleDraw content = new SimpleDraw(new DrawGraphics());
/* ... more stuff ... */
}
}

Assignment 5: main()

Programs start at a main() method, but many classes can have main() public class SimpleDraw {
/* ... stuff ... */ public static void main(String args[]) {
SimpleDraw content = new SimpleDraw(new DrawGraphics());
/* ... more stuff ... */
}
}

public class DrawGraphics {
BouncingBox box; public DrawGraphics() { box = new BouncingBox(200, 50, Color.RED);
}
public void draw(Graphics surface) {

surface.drawLine(50, 50, 250, 250);

box.draw(surface);

}
}

public class DrawGraphics {
BouncingBox box; // a field or member variable public DrawGraphics() { box = new BouncingBox(200, 50, Color.RED);
}
public void draw(Graphics surface) {

surface.drawLine(50, 50, 250, 250);

box.draw(surface);

}
}

public class DrawGraphics {
BouncingBox box; public DrawGraphics() { // constructor box = new BouncingBox(200, 50, Color.RED);
}
public void draw(Graphics surface) {

surface.drawLine(50, 50, 250, 250);

box.draw(surface);

}
}

public class DrawGraphics { public void draw(Graphics surface) { surface.drawLine(50, 50, 250, 250); box.draw(surface); surface.fillRect (150, 100, 25, 40); surface.fillOval (40, 40, 25, 10); surface.setColor (Color.YELLOW); surface.drawString ("Mr. And Mrs. Smith", 200, 10);
}
}

public class DrawGraphics {
ArrayList boxes = new ArrayList(); public DrawGraphics() {

boxes.add(new BouncingBox(200, 50, Color.RED));

boxes.add(new BouncingBox(10, 10, Color.BLUE));

boxes.add(new BouncingBox(100, 100, Color.GREEN));

boxes.get(0).setMovementVector(1, 0);

boxes.get(1).setMovementVector(-3, -2);

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Nt1310 Unit 3 Lab Report

    • 665 Words
    • 3 Pages

    The ping pong balls stack on top of one another in a three dimensional mode.…

    • 665 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    JCT2 Task 1

    • 1659 Words
    • 8 Pages

    Supply Chain (JCT2) Task 1 Business Fundamentals Simulation Review A. Documents From Simulation Cumulative industry results for last four quarters ending in quarter: 4 Minimum Maximum Average Mr. Matts Machines Total Overall 0.00 749.39 11.82 1.75 Financial Performance -73.50 211.50 9.41 6.46 Market Performance 0.00 0.65 0.11 0.44 Marketing Effectiveness 0.00 0.82 0.24 0.67 Investment in Future 0.00 468.30 1.22 1.71 Wealth -2.12 5.21 0.47 0.93 Human Resource Management 0.00 0.82 0.25 0.77 Asset Management 0.00 2.63 0.38 0.78 Manufacturing Productivity 0.00 1.00 0.25 1.00 Financial Risk 0.00 1.00 0.32 0.95 Income Statement Quarter 1 Quarter 2 Quarter 3 Quarter 4 Gross Profit Revenues 0 1,643,600 3,600,500 4,298,600 - Rebates 0 48,700 101,800 123,000 - Cost of Goods Sold 0 1,237,849 2,174,294 2,500,626 =…

    • 1659 Words
    • 8 Pages
    Powerful Essays
  • Better Essays

    Jdt2 Task 1

    • 1786 Words
    • 8 Pages

    | Per your request to investigate and recommend Toy Company’s position regarding Claim #1-2013; this report was generated. The initial research has been finalized and recommendations determined. I will refer to the claim by its number #1-2013 and the claimant as AA23 to keep the confidentiality of the claimant. First this report will provide a summary of the claim and the history associated with it. Second it will discuss the definition of Constructive Discharge and its relevance to this claim. Third it will provide the specific areas under the Title VII of the Civil Rights Act of 1964. Fourth it will offer recommendations and supporting legal references. Fifth it will recommend proactive steps to avoid future legal issues in relationship to the Title VII of the Civil Rights Act of 1964. And finally any references used in this research will be provided. A. Definition of Constructive DischargeSummary of Claim and history:In January 1, 2013 a new policy was implemented to support exponential company growth. This policy impacted all production employees. The impacted employees were notified of the changes two months in advance of the January 2013 implementation to allow for assimilation and training on the new shifts schedules and there impacts. Production employee schedules were shifted from a Monday through Friday schedule, 8 hour shift to a Monday through Sunday schedule, 12 hour shift, four working days can occur any day of the week. This schedule requires all production employees to work on holy days regardless of religious affiliation as the production now runs seven days a week.Office staff members were not impacted by this policy change.AA23 quit on January 2, 2013 after new policy was in effect.…

    • 1786 Words
    • 8 Pages
    Better Essays
  • Powerful Essays

    Student will learn how to write Java programs to perform simple calculations, they will use Scanner class to obtain input from the console, they will know how to use identifiers to name variables, constants, methods, and classes. The use of constants , Java primitive…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Powerful Essays

    Comp3652 Unit 2 Assignment

    • 1090 Words
    • 5 Pages

    routines, nor to create your own classes to manage the drawing of shapes to the screen.…

    • 1090 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    13. This attribute configures how content is situated to the left, right, or center of a Web page: align…

    • 335 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    JDT2 Task 3

    • 2402 Words
    • 8 Pages

    Higher employee satisfaction – When an appraisal is exquisitely prepared and well delivered employees are prone to respond better to the feedback presented. The employees also come away from the meeting with a clear understanding of their performance and where improvement is needed. They will also have good understanding of the company’s goals both for itself and for the employee themselves.…

    • 2402 Words
    • 8 Pages
    Good Essays
  • Better Essays

    JNT2 Task 1

    • 1417 Words
    • 6 Pages

    The City of Houston currently finds itself in quite a quandary. With a looming budget deficit of nearly $142 million dollars, city leaders have asked employees to begin to re-engineer work processes, cut costs wherever possible and eliminate unnecessary spending. While departments have all been mandated to cut 1% of their total budget for the next fiscal year, there still lies the issue of employees streamlining their work processes in order to eliminate any unnecessary waste.…

    • 1417 Words
    • 6 Pages
    Better Essays
  • Better Essays

    JOT2 Task 1

    • 839 Words
    • 4 Pages

    I recently left a position at a small Early Childhood Education center in the city of Pittsburgh, Pennsylvania. The school consisted of children ranging in age of 6 weeks to 6 years. I worked there for eleven years in a variety of age groups. Most of my experience was in Preschool, with children who were three and four years old. The school was located in Point Park University located in the heart of downtown Pittsburgh, in one of the University’s dorm buildings and took up two floors. Each classroom was between three and four dorm rooms combined in size. The rooms were long and narrow with partial walls knocked down and converted into doorways between the rooms. Because of the classrooms being converted from individual dorm rooms to single classrooms, there were many blind spots in the room. There for, each classroom had at least two teachers spread out among the room to be able to see every child and what they were doing at all times. It was very rare that there were only two teachers per class. Many times, the classroom had two teachers, and students from the university enrolled in a work study program helping to work with fifteen to twenty students.…

    • 839 Words
    • 4 Pages
    Better Essays
  • Good Essays

    Phase 2 Db

    • 390 Words
    • 2 Pages

    The benefits of using Java it support graphic user interfaces (GUI) via the Abstract Windowing Toolkit (AWT). AWT is the original GUI toolkit made for Java and introduced along with JDK. AWT provides support for graphics programming and working with IDE’s (Integrated Development Environment). IDE’s support the development of UI’s using drag and drop features to pull components from a toolbar and developing codes for the programmer. These features make creating GUI applications easier for the programmer utilizing the Java platform.…

    • 390 Words
    • 2 Pages
    Good Essays
  • Good Essays

    JNT2 Task 1 1

    • 787 Words
    • 4 Pages

    Discussion of Data Collection Instruments Used: If students can identify letter names and sounds, why can they not successfully identify beginning, middle and ending sounds of any given word? How many students are below benchmark standards? Is district-wide sponsored curriculum supporting benchmark testing standards? Are additional interventions necessary?…

    • 787 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    code program

    • 317 Words
    • 2 Pages

    (Design, approach, lessons learned) - Write a summary of the design of your program, how you coded it, and the lessons you learned from the programming assignment here: Well first of all I started by copying my hello world code into the notepad text editor. You know learning something new like Java at first is a little scary but I think going forward I will get more understanding of this application with no problems at all. So I learned to just hang in there and keep learning.…

    • 317 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    JNT2 Task 1 Needs Analysis

    • 2841 Words
    • 19 Pages

    Many students who struggle with reading ask why should we read, what is the point? The point is that being able to read opens you up a whole new world of knowledge and imagination. But to have that new world opened up you need to be able to comprehend what you are reading. The primary goal of reading is to determine the meaning of what the writer is communicating and make the most of that information. That’s why reading comprehension skills are so important. Without them the reader cannot gather any information and use it to efficiently function and enjoy the richness of life (Marshall).…

    • 2841 Words
    • 19 Pages
    Powerful Essays
  • Better Essays

    JNT2 Task 1

    • 2089 Words
    • 9 Pages

    Much like the runways of Paris with its changing fashion trends, the world of education follows trends as well. Educators cringe when they hear “No Child Left Behind” some ten years beyond its advent. Now, the phrases “Common Core” and “Student Learning Objectives” have teachers seeing red.…

    • 2089 Words
    • 9 Pages
    Better Essays
  • Powerful Essays

    It 210 Weeks

    • 2760 Words
    • 12 Pages

    This course provides students with a basic understanding of programming practices. Concepts covered include flowcharting, pseudocode methodologies, and an understanding of programming practices. Students will learn how these concepts, when properly applied, improve program design.…

    • 2760 Words
    • 12 Pages
    Powerful Essays