Elaina Brown

Greenhorn
+ Follow
since Nov 01, 2018
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Elaina Brown

Also, Main Is A Pain article shared was a lifesaver and cleared up my confusion with what main did.
5 years ago

Campbell Ritchie wrote:You should move all that code out of the main method. As it says here, a main() method ideally contains one statement. All that code should be in different methods.



I apologize for not including more information about what was wrong. I was receiving could not find this symbol errors for my variables, scanner, and constant.

Which after reading this, I was like "duh". I am not sure how that didn't dawn on me.    Since my scanner object and constant are outside of my main I can not put a do while loop within it. Especially since I pass my scanner object through my methods as a parameter. So I will work on moving everything out of main. I would post more of the program, but since it is an assignment I want to work on it myself as much as possible. Again, this forum has been nothing short of helpful.
5 years ago
What the program is:
I am working on a program that asks for a user to input their waist measurement, height measurement, gender, and minutes worked out each week. It then calculates the user's waist to height ratio ( waist / height *100). Afterwards it prints the user's height (in), waist (in), waist to height ratio, health status ( underweight, healthy weight, etc based of gender and ratio), and then total amount of minutes work-outed each week.

My current issue:
A part of this program is to ask the user if they want to perform another health calculation, which restarts from the beginning of the main method if they do. If not, it will thank the user for using the program. I am having a hard time getting it to work.  

Add. Detail:
Everything in my main method calls outside methods, which is why my scanner is outside of the main method.
I am not including my outside methods, but can if need be.

5 years ago
It was an issue with Java. I had installed Java 11, and also had versions 10 and 8. I now just have version 10.0.2 ( it will not run with the latest version).
It works like a charm now. Thank You. Sorry for the late response.
5 years ago
I was using jGrasp to write my program, however, it was suggested I try Eclipse in one of my posts on here.  My program runs in jGrasp, but I get an error when I attempt to run it in Eclipse . I have the package named Brown_5, and my class is Brown_5 (saved under the same name as well). I selected it to run in Java 10.0.2 which is what I have installed on my PC. I did attempt Java 1.8 as suggested in another form with no luck. I prefer Eclipse since it debugs as you write the code, and formats like a charm. I am just struggling with getting it to run my program.  Any suggestions?

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package jdk.internal.jimage.decompressor in both module jrt.fs and module java.base
5 years ago
I appreciate all of the time and effort everyone on my post has put in to help me. This is the first code I have ever written so I know it is messy, and needs a load of work so your patience is beyond appreciated. I know it is not the best, but I did try to make some improvements. ( My professor wants use to use && and || as it is part of a operand lesson so I did not correct that part). I am still struggling a great deal getting my nested if / else statement into a method outside of main. When I do I get an error that is an illegal start of an expression, I think this is because something is wrong with my formatted, but I am determine to figure it out. I hope it looks a little better and I again can thank everyone enough for all of the help!

5 years ago
I need to create a method for recording the Gender, the height and waist, and I need to move my if / else statement into a method. You will see I tried to create a method for gender, but I get test4.java:35: error: method getGender in class test4 cannot be applied to given types;. I have read that it is becuase I am passing it without parameters but my Professor wants it without parameters. I also am struggling to get the total mins excercised a week, it will ask 7 times for amount of minutes exercised but how do I call the results. I know this is a alot but any help, and I would be grateful.






5 years ago