Comp 274 Week 5 Assignment

Decent Essays
//Sheree Elder
//COMP 274
//Week 5 Assignment

//Ball File import java.awt.*;

public class Ball
{
//Size of the ball (diameter) int Size; //X, Y position of the ball is the upper left corner of the minimal box containing the ball int X; int Y;

//When the X increment is positive the ball is traveling to the right
//When the X is negative it is traveling to the left int Xincre; //When the Y increment is positive the ball is traveling down
//When the Y is negative it is traveling up int Yincre; public Ball(int diameter, int distance)
{
Size = diameter; Xincre = distance; Yincre = distance;

//Ball starting point(position) X=0; Y=0;
}

public void newPosition(int widthW, int heightH)
{

//Method adds the X increment to the
…show more content…
//The getLeft and getRight methods return an X position public void newPosition(int x, int y)
{
XpositionP= x;
}
public int getTop()
{
return YpositionP;
}
public int getBottom()
{
return YpositionP + WidthW;
}
public int getLeft()
{
return XpositionP - lengthL;
}
public int getRight()
{
return XpositionP + lengthL;
}

//Draws the Paddle and sets the color of the Paddle public void drawPaddleP (Graphics
…show more content…
//Sets the color of paddle to GREEN graphic.setColor(Color.GREEN);
//Creates the shape of the paddle to be rectangle and how the paddle is positioned graphic.fillRect(XpositionP-lengthL, YpositionP,lengthL, WidthW );
}
}
//Sheree Elder
//COMP 274
//Week 5 Assignment

//Display File

import javax.swing.*; import java.awt.*;

//Class extends the JPanel class public class Display extends JPanel
{
Controller controllerC; JFrame frameF; Display(Controller c) { controllerC = c; //Storing the controller //Creates a frame frameF= new JFrame(); frameF.add(this); frameF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Object will terminate frameF.setSize(600, 600);//Window size to be 600 pixels wide/600 pixels high frameF.setVisible(true);//Window with object becomes visible due to JFrame }

// public void paintComponent(Graphics graphic)
{
graphic.setColor(Color.GRAY);//Sets the background to a color GREY graphic.fillRect(0,0,getWidth(),getHeight()); controllerC.drawgame(graphic);
}
}

//Sheree Elder
//COMP 274
//Week 5 Assignment

//Controller File

import java.awt.*; import java.awt.event.*; import javax.swing.Timer;

//Class must implement the ActionListener interface deal with Timer events which drives the

Related Documents

  • Decent Essays

    Chris is out of the office today and will return tomorrow. The file was hold until pay off was received. The file will be moved to audit and closing department tomorrow. The final number will come from the title company. Once the file is assigned a closer I will get with closer regarding 2016 property taxes.…

    • 63 Words
    • 1 Pages
    Decent Essays
  • Decent Essays

    Pb2 Week 2 Assignment

    • 230 Words
    • 1 Pages

    PB2 Date: 08.06.2017 Project Category: WISE Community Mental Health - PHaMs. Support Description: N/A Session: N/A Information and Reminders: 1.- Well-being: Penny informed the writer that last Saturday was admitting to the emergency department due a psychotic episode. On that week she went to see her GP and he recommended reducing her anti-depression tables from 150grs of prastrke to 50grs. Penny believed that this is the reason why she felt terrible sick and suicidal.…

    • 230 Words
    • 1 Pages
    Decent Essays
  • Decent Essays

    PB2 Week 2 Assignment

    • 227 Words
    • 1 Pages

    PB2 Date: 28.08.2017 Project Category: WISE Community Mental Health - PHaMs. Support Description: N/A Session: N/A Information and Reminders: 1.- Updates: 1.1.- King Kids Child Care Center: Re: Special Child Care Benefit (SCHB).…

    • 227 Words
    • 1 Pages
    Decent Essays
  • Decent Essays

    I was wondering if you could possibly sign as my academic advisor so that I can enroll for an overload and register in an upper-division Breech course? (I would have asked my regular advisor which is Dr. Vandenberg but I think he's unavailable for the rest of this week and next week)? Can you please sign them instead?…

    • 58 Words
    • 1 Pages
    Decent Essays
  • Improved Essays

    The article I read in the Wall Street Journal describes, Sprint’s cost cutting plan in order to save 2.5 billion dollars. This $2.5 billion was lost in profits due to loss in customers and other expenses over the years. What was interesting about this article is how Sprint decided to go about ‘cutting’ this cost. They started by getting rid of the snacks they provided to the headquarters in Kansas. These snacks, which include water bottles and yogurt, were first provided in 2014 when a new CEO took over the company.…

    • 574 Words
    • 3 Pages
    Improved Essays
  • Improved Essays

    Asb100 Week 2 Assignment

    • 742 Words
    • 3 Pages

    ASB100 Name: Victoria Raymond Date: 9/3/14 Final Assignment: Revised $100M Plan 1. Write a brief paragraph that outlines your overarching philosophy concerning global health problems and solutions. What do you think is the best approach to spending global health funding?…

    • 742 Words
    • 3 Pages
    Improved Essays
  • Great Essays

    Nt1310 Week 5 Assignment

    • 1313 Words
    • 6 Pages

    This Week Five Assignment will focus on the components of the neuroscience aspects topic of the Post-traumatic Stress Disorder (PTSD). I will include the causes of it which is the theories of etiology. I will also review how the factors develops it’s genetic, environmental, familial or lifestyle. I will analyze the pathology, including genetics and biochemical aspects. Then, having to diagnose the research technologies on PSTD.…

    • 1313 Words
    • 6 Pages
    Great Essays
  • Improved Essays

    Pool Pocket Problem Statement: There are four sides and four corners. The corners are top left/right and bottom left/right. Top Left: 1 Top Right: 2 Bottom Left: 3 Bottom left: 4…

    • 569 Words
    • 3 Pages
    Improved Essays
  • Improved Essays

    A soccer ball is made of leather on the outside and is pumped with air so it is still able to soar through…

    • 1285 Words
    • 6 Pages
    Improved Essays
  • Improved Essays

    You can feel the water flowing under your feet and each little tug on your line will feel more amplified by the way that your paddle board will rock back and forth. When you actually hook a fish, you will feel it pulling you in a way that you will never feel it when you are on a boat, even if it is only a small fish on the end of your line. It takes balance to stay upright on the board while battling the fish. It takes skill to win the battle and you can get into areas where most people will never be able to fish. What Is an Inflatable Fishing Paddle Board?…

    • 640 Words
    • 3 Pages
    Improved Essays
  • Decent Essays

    Hello. Today we would like to talk about Darts. Have you ever tried Darts? There are various kinds of it, such as 01, cricket, count up and so on.…

    • 96 Words
    • 1 Pages
    Decent Essays
  • Great Essays

    Phase A Testing Essay

    • 1640 Words
    • 7 Pages

    4. PHASE A TESTING 4.1. PURPOSE The primary purpose of Phase A testing is to evaluate the feasibility of an Arduino-based system in regards to the load sensor’s ability to weigh the balls and send this information to the Arduino.…

    • 1640 Words
    • 7 Pages
    Great Essays
  • Improved Essays

    Accuracy and Precision Lab Report By Connor MacFarland 10.23.2016 IBC 1 Question What is the difference between accuracy and precision and how can we demonstrate the difference? MATERIALS Pencil Notebook Paper 100 mL Graduated Cylinder 1 Gallon of water Ruler Unmarked Plastic Container 3 different kinds of Rocks of different sizes Triple Beam Balance PROCEDURE…

    • 965 Words
    • 4 Pages
    Improved Essays
  • Superior Essays

    Eliyahu M. Goldratt and Jeff Cox has written this novel on THEORY OF CONSTRAINTS or basically the theory of bottleneck in terms of operation and supply chain. Bottleneck, or constraint, refers to the limitation or the limiting factor present in the process of a production, or work which can narrow down the efficiency of the whole production system. Theory of constraints tells you to either remove the limiting factor or improve it until it is not a hurdle in the process flow. This book is basically on a plant production manager of UniCo.…

    • 1212 Words
    • 5 Pages
    Superior Essays
  • Improved Essays

    6404 Economics of the Public Sector Semester 2, 2015 Student: u3102883 Week 10 Tutorial 6 Consider two projects, A and B, with capital costs of $100 million and $20 million respectively. Given an opportunity cost of capital of 7 per cent, A provides an NPV of $30 million. B provides an NPV of $10 million. Explain why A is better than B, although it costs five times as much and produces only three times the net benefit.…

    • 782 Words
    • 4 Pages
    Improved Essays