![]() |
|
[Java] Creating a simple java program for assignment - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Creating a simple java program for assignment (/showthread.php?tid=5418199) |
Creating a simple java program for assignment - Kush Coma - Sep 27, 2016 Hey guys, so this is the set of instructions i got from my professor. I didn't pay attention to this part of the class and it's supposed to be something easy and I'm kinda confused so i'm wondering if anyone can walk me through this and of course you will be rewarded. Quote:Using jGRASP, write a Java program that does the following: * - Skidsuper - Sep 27, 2016 well the first thing would be to go to http://jgrasp.org/ and download and install it. After that watch their tutorials. https://www.youtube.com/watch?v=DHICqIYV33k Then try again yourself. PM me if stuck. * - StayTech666 - Sep 28, 2016 You'll have to be more specific on what you're stuck on. I'll assume you want someone to do this for you? * - kamika$e - Sep 28, 2016 lol why are you using jgrasp, seems like an odd ide to use. Ask the user to enter in 3 numbers - Scanner class, google it Keep in mind that the user may enter numbers with decimals - Doubles and floats exist in java Ask the user 3 times to enter a number - ask user through the scanner class Print the three numbers with labels - system.out.println Print the average of the numbers. - use math then print it * - Mohinder - Sep 29, 2016 I think the most easiest way to code this is doing it by this: Code package com.hackforums;Havent run it, but it should work. * - Stealthâ„¢ - Sep 29, 2016 (Sep 29, 2016 12:36 PM)lolxd123 Wrote: You should learn what magic numbers are before calling someone an idiot. * - Stealthâ„¢ - Sep 29, 2016 (Sep 29, 2016 07:52 PM)lolxd123 Wrote: I know exactly what a magic number is. However, that is completely irrelevant to my response (what I stated does not even regard to magic numbers). Assigning 3 to a variable is still considered hard coded, which is poor wording by the professor. That can easily confuse someone new to programming. You really don't understand magic numbers, lol. And variable naming conventions have absolutely nothing to do with magic numbers. * - shashwat97 - Sep 30, 2016 With respect to the above conversation (using python like pseudo code, cause that's the simplest to read and write) Code sum = num1+ num2 + num3;The above code avoids usage of magic numbers but still does hard code 3. A non hard-coded solution would be something like Code list = []So I guess both of you are trying to say the same thing. |