• Post Reply Bookmark Topic Watch Topic
  • New Topic

I don't have a clear direction  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im in my last class to complete my associates degree in Cyber Security. Im currently taking ITP 120 (Java Programming) and I am absolutely and completely lost.
My class consists of a 3 1/2 lecture and then told at the end of class to wait for the next HW assignment in an email.

My background. I quit my law enforcement job over 1 1/2 years ago to go back to school full-time and fast forward to today and Im in my last class for my degree.
I dont know any programming and I am honestly and sincerely paying attention in class. Im 30yrs old so I know how important programming really is and I actually want to learn. Ive been looking at youtube videos, articles, trial and error, etc. and I still dont have a clear direction of what the hell Im supposed to do.... with anything JAVA.....

Its so discouraging to say but Im going to complete my associates degree in cyber security and the most I learned from the degree/college is that If you memorize the quiz questions you will ultimately pass the class. Which leads me to here.


These are our instructions:

Design a Java program that calculates and then outputs the sum of all odd and then all even numbers between 0 and 100 separately. The program finally prints which of these summations is higher and also prints the difference between these two summations.

Tips :  ( For Odd numbers generate and add : 1 + 3 + 5 + 7 + ... + 97 + 99 and for Even numbers generate and add  2 + 4+ 6 + 8 + ... 98 + 100 ).You may use the repetition method of your choice (for-loop, while, or do-while) to design your flowchart.
 
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Esteban. You have come to the right place.

To start, please post whatever code you can manage to cobble together as a starting point (please UseCodeTags) and you can get help from there.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, something everyone needs to learn is that coding is 90% thinking, and 10% typing. 

think about what you need to to. What are all the little pieces or steps?  So for starters, your assignment says to do two things separately.

So the first think I would do is pick ONE to start with, and completely ignore the other. Let assume you want to do the odds first.

Now the problem is easier. So think about that. How would you add up all the odd numbers from 0 to 100? Pretend you are talking to a 10yr old child, giving them directions on how to do it. What would you tell them?

That's how you approach programming problems.  You break a large problem down into smaller problems, then you break those down, again, and again, and again...Once you have the smallest steps, you start writing it in code, testing and validating it after adding each new piece.

As Bear says, post what you have done so far - if anything. We don't know what you know, so you may need help installing the JDK.  or writing/compiling a "Hello, World" program. We need to know exactly where you are to give you the best help.
 
Esteban Banfield
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Welcome to the Ranch, Esteban. You have come to the right place.

To start, please post whatever code you can manage to cobble together as a starting point (please UseCodeTags) and you can get help from there.


Hey Bear! ok I will.

Im on my work computer ATM and I work for a fed agency so I cant connect my personal laptop to my work wifi... lame, i know.

 
Esteban Banfield
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:Also, something everyone needs to learn is that coding is 90% thinking, and 10% typing. 

think about what you need to to. What are all the little pieces or steps?  So for starters, your assignment says to do two things separately.

So the first think I would do is pick ONE to start with, and completely ignore the other. Let assume you want to do the odds first.

Now the problem is easier. So think about that. How would you add up all the odd numbers from 0 to 100? Pretend you are talking to a 10yr old child, giving them directions on how to do it. What would you tell them?

That's how you approach programming problems.  You break a large problem down into smaller problems, then you break those down, again, and again, and again...Once you have the smallest steps, you start writing it in code, testing and validating it after adding each new piece.

As Bear says, post what you have done so far - if anything. We don't know what you know, so you may need help installing the JDK.  or writing/compiling a "Hello, World" program. We need to know exactly where you are to give you the best help.


@FRED,

You know in my struggles of trying to figure the problem out I told myself, "Let me take this apart and see what I can think up."

So after taking a step back and looking at the problem with fresh eyes ive gathered that you are absolutely right. There are 3 things in this problem that my Prof wants me to do.

     -I need to write something that finds the sum of all the even numbers from 0-100
     -I need to write something that finds the sum of all the odd number from 0-100
     -I need to write something to calculate the difference of both sums

Were currently using Textpad8





 
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Esteban Banfield wrote:
Im on my work computer ATM and I work for a fed agency so I cant connect my personal laptop to my work wifi... lame, i know.

I hope that's a tongue-in-cheek remark. Wireless network security is a major concern anywhere and more so at a Federal government facility. As a student of cybersecurity, you must appreciate the need to restrict network access to only authorized and certified devices, right?

Regarding your programming problem, what kind of looping construct(s) are you familiar with?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Esteban Banfield wrote:
So after taking a step back and looking at the problem with fresh eyes ive gathered that you are absolutely right. There are 3 things in this problem that my Prof wants me to do.

     -I need to write something that finds the sum of all the even numbers from 0-100
     -I need to write something that finds the sum of all the odd number from 0-100
     -I need to write something to calculate the difference of both sums


If you think about it a bit more, you'll realize that #1 and #2 are really the same thing...you want to sum up some number from <some lower limit> to <some upper limit>, and you wan to increment by <some amount>.  So if you are clever, you can write a method that takes three parameters:
startingValue
upperLimit
incrementAmount

If you write that method, and test the HECK out of it, then #1 and #2 are easy.  You'd just call this one method twice, with slightly different parameters. And, then you have a method that can be re-used for a wide variety of circumstances...multiples of 5 from 0 to 10,000.  odd numbers from -200 to 17.   etc.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!