SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 210 Weeks Ago, 4 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 01 Nov 2017 My Price 9.00

Prompt: This assignment provides an opportunity

Ive been mulling over this assignment for a while now. I cant figure out if its a naming issue or if my methods are returning the wrong values or what.

 

 

 

 

Prompt: This assignment provides an opportunity to work with defining classes and creating objects (instantiating) from those classes. The exercise consists of source code that contains errors; therefore, it neither compiles nor runs correctly. It focuses on a console application, but the concepts translate across C# programming. Consider the following C# console program that contains four programming errors. For the sake of simplicity and space, two classes are defined in the same file as opposed to the best practice of defining one class per file: 

 

#region Using directives

using System;

using System.Collections.Generic;

using System.Text;

#endregion

namespace Classes

{

  class Program

  {

    static void Main(string[] args)

    {

      Point origin = new Point();

      Point bottomRight = another Point(1366, 768);

      double distance = origin.DistanceTo(bottomRight);

      Console.WriteLine("Distance is: {0}", distance);

      Console.WriteLine("Number of Point objects: {0}", Point.ObjectCount());

    }

  }

  class Point

  {

    private int x, y;

    private int objectCount = 0;

    public void Point()

    {

      this.x = -1;

      this.y = -1;

      objectCount++;

    }

    public Point(int x, int y)

    {

      this.x = x;

      this.y = y;

      objectCount++;

    }

    private double DistanceTo(Point other)

    {

      int xDiff = this.x - other.x;

      int yDiff = this.y - other.y;

      double distance = Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));

      return distance;

    }

    public static int ObjectCount()

    {

      return ObjectCount;

    }

  }

}

Answers

(5)
Status NEW Posted 01 Nov 2017 09:11 AM My Price 9.00

----------- He-----------llo----------- Si-----------r/M-----------ada-----------m -----------Tha-----------nk -----------you----------- fo-----------r y-----------our----------- in-----------ter-----------est----------- an-----------d b-----------uyi-----------ng -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------. P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll -----------be -----------qui-----------ckl-----------y

Not Rated(0)