V_Eaton_HOMEWORK 2_CMIS141 - Running Head HOMEWORK 2 1...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Running Head: HOMEWORK 2 HOMEWORK 2 William Welch Introductory Programming UMUC Vicki Eaton 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
HOMEWORK 2 /* * File: Homework2.java * Author: Vicki Eaton * Date: February 5, 2017 * Class: CMIS 141 6382 Introductory Programming * Problem: Create a Java program that creates 5 polygons * Instructor: William Welch * * Purpose: To write a java code using a private int data field, private double data field, * private double field xCoord, private double field yCoord, private double field apothem , * private double field named perimeter , no argument constructor, a constructor that creates a * polygon with specified number of sides, length, apothem and coordinates. Getter and setter * methods field. * Status: Ready * Notes: This was extremely hard to do! * History: * January 27, 2017 work on labs to figure out homework * January 28, 2017 Watch numberous Youtube videos. * January 29, 2017 Frustrated with this code * February 1, 2017 I think I uderstand trying to straighten it out to run correctly!! * February 2, 2017 Still watching videos and reading lectures and labs over and over. * February 3, 2017 I think I understand it Fixing and fixing and changing and writing. * February 3, 2017 Pulling my hair out, but running labs again to figure it out. * February 4, 2017 I think I got it this is the hardest thing I had to do so far. Runs, then errors * Fix errors, running two IDE. * February 5, 2017 I got it to work!!! Now do I have it all correct?? */ public class Polygon { private int numSides ; private double sideLength ; private double xCoord ; private double yCoord ; private double apothem ; public double perimeter ; /** * constructor with no argument */ public Polygon() { numSides = 4; sideLength = 5.0; xCoord = 0.0; yCoord = 0.0; 2
Image of page 2
HOMEWORK 2 apothem = 5.0; perimeter = 20.0; } /** * constructor with parameters */ public Polygon( int numSides , double sideLength , double xCoord , double yCoord , double apothem ) { this . numSides = numSides ; this . sideLength = sideLength ; this . xCoord = xCoord ; this . yCoord = yCoord ; this . apothem = apothem ; } // getters and setters public int getnumSides() { return this . numSides ; } public void setnumSide( int numSides ) { this . numSides = numSides ; } public double getsideLength() { return this . sideLength ; } public
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern