I need help for an assignment. please

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 504 Views - Last Post: 06 February 2019 - 10:11 PM Rate Topic: -----

#1 tatumcalloway   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-February 19

I need help for an assignment. please

Posted 03 February 2019 - 07:34 PM

I entered my AP computer science course late, and I am for real struggling. I feel like I am pretty good a reading and editing code but when it comes to writing it myself, I seriously cannot. I am not looking for someone to do this assignment for me, but if someone could please point me in the right direction of where to start or if there are any good examples out their I could model my code to, I'd really appreciate it. Thanks so much.

https://cms.gavirtua...onse%202010.pdf

Is This A Good Question/Topic? 0
  • +

Replies To: I need help for an assignment. please

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14761
  • View blog
  • Posts: 59,004
  • Joined: 12-June 08

Re: I need help for an assignment. please

Posted 03 February 2019 - 07:56 PM

What have you tried, thought about, or considered?
Was This Post Helpful? 0
  • +
  • -

#3 tatumcalloway   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-February 19

Re: I need help for an assignment. please

Posted 03 February 2019 - 09:05 PM

View Postmodi123_1, on 03 February 2019 - 07:56 PM, said:

What have you tried, thought about, or considered?


i haven't tried much just every time i try to write a code from scratch, i always have coding errors. Once i couldn't find good examples for me to model my code after I joined up here. Was the assignment pic visible? I don't really know how to work this site very well.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14761
  • View blog
  • Posts: 59,004
  • Joined: 12-June 08

Re: I need help for an assignment. please

Posted 03 February 2019 - 09:13 PM

Seemed the last paragraph explains the class name, wants a constructor with specific parameters, a specific method, and what that method should do. I would start there.
Was This Post Helpful? 0
  • +
  • -

#5 tatumcalloway   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-February 19

Re: I need help for an assignment. please

Posted 03 February 2019 - 09:44 PM

View Postmodi123_1, on 03 February 2019 - 09:13 PM, said:

Seemed the last paragraph explains the class name, wants a constructor with specific parameters, a specific method, and what that method should do. I would start there.


Yeah, i just don't know how to do that. and i know it should be simple, but this is my first time ever studying this course and it's not clicking so pls don't judge :)
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14761
  • View blog
  • Posts: 59,004
  • Joined: 12-June 08

Re: I need help for an assignment. please

Posted 03 February 2019 - 09:53 PM

I would think should take a direct beeline to your instructor for help. With nothing shown and not willing to take a crack at that last paragraph I am not sure what you want folk to do outside of just giving you the assignment completed.
Was This Post Helpful? 1
  • +
  • -

#7 macosxnerd101   User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12506
  • View blog
  • Posts: 45,641
  • Joined: 27-December 08

Re: I need help for an assignment. please

Posted 03 February 2019 - 10:14 PM

There are a lot of good resources on Object-Oriented Programming:
https://www.dreaminc...igning-classes/
https://www.dreaminc...arallel-arrays/
https://docs.oracle....epts/index.html

You should definitely check them out.

I did look at your assignment- it is really straight-forward. I doubt anyone could get you started without giving it away. There really isn't any problem solving involved. This assignment is to ensure that you familiarize yourself with the basic syntax. I think at this point, you really need to make the effort to get started. If you can't even do that, then you should discuss this with your instructor.


Quote

when it comes to writing it myself, I seriously cannot... i know it should be simple, but this is my first time ever studying this course and it's not clicking


Programming is hard, and everyone struggles their first time learning this. Learning how to program is something that is gained by trying, making mistakes, and figuring out how to correct those mistakes. It is not possible to learn how to program by simply reading code, modifying someone else's code, or listening to someone explain things. You actually have to practice writing code yourself.

You are falling into the trap of "shutting down" when things don't immediately work or come easy. The more you fight through the frustration to fix even some of your errors, the better you will get.
Was This Post Helpful? 4
  • +
  • -

#8 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2730
  • View blog
  • Posts: 10,898
  • Joined: 03-December 12

Re: I need help for an assignment. please

Posted 04 February 2019 - 10:32 AM

You are going to run into errors, a lot. Everyone here still runs into errors.

Make some attempts and see how it goes. If you run into issues, post the issue and what you tried; make an honest effort and people will help. But, as was said, without an attempt, it seems like you want the work done for you because it's hard - and that won't help you.
Was This Post Helpful? 2
  • +
  • -

#9 hexagod   User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 444
  • Joined: 29-October 16

Re: I need help for an assignment. please

Posted 04 February 2019 - 12:11 PM

You're lucky that my usual IDE is not installed on this loaner work computer and I'm bored, craving some programming work. I actually don't know java so you will need to modify this and also I don't have an IDE ATM so this is pseudocode. Intellisense and compiler info has ruined me.

OK, so let's break this down a piece at a time:

first off, we're going to need to create a class for the line and we will be using integers and doubles. The class will obey algebraic principles for each variable and may contain a method for getting values from an inputs.

checkit yo :gun_bandana:
class APLine 
{
  int a;
  int b;
  int c;
  double x;
  double y;
  double calc;
  double _slope;
  

  bool _isOnLine;

  getSlope(a, b )         
  {
    _slope = -a / b;
    return _slope;
  }

 isOnLine (a, x, b, y, c )
 {
  
     if (a == 0 || b == 0) 
     {
       _isOnLine = false;
       return _isOnLine;
     }
     calc = (a * x) + (b * y) + c;
     if (calc == 0)
     {
      _isOnLine = true;
      return _isOnLine;
     }
     else
     {
      _isOnLine = false;
      return _isOnLine;
     }

 }
}

This post has been edited by hexagod: 04 February 2019 - 12:25 PM

Was This Post Helpful? 0
  • +
  • -

#10 hexagod   User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 444
  • Joined: 29-October 16

Re: I need help for an assignment. please

Posted 04 February 2019 - 12:17 PM

sorry about double post the website was turning B) into an emoji even in the code block and it messed with my answer

This post has been edited by hexagod: 04 February 2019 - 12:19 PM

Was This Post Helpful? 0
  • +
  • -

#11 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14761
  • View blog
  • Posts: 59,004
  • Joined: 12-June 08

Re: I need help for an assignment. please

Posted 04 February 2019 - 12:23 PM

Let's ease up on doing it for them. ;)
Was This Post Helpful? 3
  • +
  • -

#12 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2730
  • View blog
  • Posts: 10,898
  • Joined: 03-December 12

Re: I need help for an assignment. please

Posted 04 February 2019 - 01:03 PM

Not only, let's not give out answers, but cause more confusion when what you give does not follow the requirement to begin with.
Was This Post Helpful? 1
  • +
  • -

#13 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2730
  • View blog
  • Posts: 10,898
  • Joined: 03-December 12

Re: I need help for an assignment. please

Posted 04 February 2019 - 01:29 PM

So, this gives you your test cases, sample data; and what should be returned.
APLine line1 = new APLine(5,4,-17);
double slope1 = line1.getSlope(); // slope1 is assigned -1.25
boolean online1 = line1.isOnline(5,-2); // true because 5(5)+4(-2)+(-17)=0


So, without actually giving you too much information on how to solve this:
You need a constructor that takes in three arguments(a,b,c)
APLine line1 = new APLine(5,4,-17);

You need a method named getSlope() that returns a double and operates on the variables passed into the constructor.
double slope1 = line1.getSlope(); // slope1 is assigned -1.25

Lastly, you need a method named isOnLine that returns a boolean, and takes two integer arguments.
boolean online1 = line1.isOnLine(5,-2);



Based on the formula, the arguments passed into the isOnLine method will be used, along with the class variables that were passed into the constructor. Following?
Was This Post Helpful? 0
  • +
  • -

#14 hexagod   User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 444
  • Joined: 29-October 16

Re: I need help for an assignment. please

Posted 04 February 2019 - 02:12 PM

ok yeah my bad I forgot it needs to have 3 constructors in the class itself, sorry I'm @ work so mostly focusing on other things and not in my IDE:

Spoiler


That definitely needs to be modified; I don't know java... but it should get you close and you can finish it off.

Please take the time to study it and ask questions. Also, don't just take my word for it you need to do the work yourself.
Was This Post Helpful? 0
  • +
  • -

#15 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2730
  • View blog
  • Posts: 10,898
  • Joined: 03-December 12

Re: I need help for an assignment. please

Posted 05 February 2019 - 08:18 AM

tatumcalloway, do you have a starting point now or still need some guidance?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2