Graham Wolk

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

Recent posts by Graham Wolk

Campbell Ritchie wrote:Welcome to the Ranch

You don't install Java® to your desktop and click the icon. You install it and use the command line to evoke it. Look at our FAQ or the Java™ Tutorials. I presume you are not using an IDE at the moment. You do need to set your PATH before Java® will run; you are probably best off setting a system PATH rather than a local PATH.



I'll take a look in the Java Tutorials, thank you!
5 years ago

Graham Wolk wrote:

Norm Radder wrote:

when I click the 64-bit installation it doesn't respond...


Is that an .exe file you are clicking on?  What is its filename?  Where did you get it?


I have Java SE Development Kit 8 Updates 161 and 152


You only need one JDK installed.  The smaller numbered one could be uninstalled.

What was the  "64-bit installation" you mentioned earlier?



This .exe here, where my cursor is



Looks like the image didn't work correctly, here is the link to my screenshot: https://imgur.com/C7jz1WE

5 years ago

Norm Radder wrote:

when I click the 64-bit installation it doesn't respond...


Is that an .exe file you are clicking on?  What is its filename?  Where did you get it?


I have Java SE Development Kit 8 Updates 161 and 152


You only need one JDK installed.  The smaller numbered one could be uninstalled.

What was the  "64-bit installation" you mentioned earlier?



This .exe here, where my cursor is

5 years ago
What exactly is a delimiter? What does that do?
9 years ago


I created a second scanner like you told me to, but at this point I'm just typing in random code without actually understanding what I'm doing. I really have no clue where this one is going.

Not to mention, this is just a simple practice problem, and I have my second Java exam in 2 weeks. I can't even figure this one out :/
9 years ago


I think I may be going in the right direction here. I can now work whatever numbers I put into the program, Ie = "Enter 4:45 / 60" result is "7".

However, now I need to figure out how to put these answers into M:SS form.
9 years ago
Ah nevermind, that isn't what I want. :/

Edit: I'm stuck again. I just can't seem to find what it is that will help me here in the Scanner package.
9 years ago
Would it be something to do with "match" or "MatchResult"?
9 years ago
Here is what I have so far:




Here's an example of what happens when I try this in the compiler:

"Enter marathon time: '4:45'"

"4:451"

It literally adds a 1 onto the string, which I thought I had converted to a number with the next method.

I'll try messing around with the Number Syntax section of the Scanner documentation.
9 years ago
I'm reading the Scanner documentation for anything I can use. I understand what I want to do: make the string into a workable number, but I can't seem to find anything like a "convert" or "change" method. I am reading about local numbers because every method that I think will work seems to lead back to that section of the documentation.

I am still having a bit of a hard time figuring it out though.
9 years ago
Ah thank you very much Campbell, your answer was the type of answer I was waiting for. Maybe I phrased my question poorly that it may have been a bit hard to understand.

Anywho, I can now see how to allow the compiler to accept colons with the nextLine method you told me to use, which is great. That's one of my issues solved .

I am now trying to figure out how to use the nextPattern method the way that it can benefit me in this problem. I have never used it before, and I am currently just fiddling around with it to make it work for me.

Let me try understanding it in plain English again,

so we have the compiler accept our input as a nextLine method. So let's say I type in 4:45 to the compiler.

The only thing that it will do is return "4:45" back to me. Okay, so now I need to have it accept "4:45" and change it to a delimiter that can be divided by 60, the first thing to do in the conversion process.

Well, I can't seem to divide the string "4:45" by 60, because I'm assuming the compiler doesn't look at "4:45" as a number, it looks at it as a word.

So I would need to find some type of method like, "changeDelimiter" or "convertDelimiter". Something like that.

In other words, I want to use the nextInt method, however, I have to cross the bridge of changing the delimiter first.

So, I tried using the delimiter method by declaring a new Pattern and declaring a new delimiter method, however, that doesn't seem to work. "Pattern" doesn't seem to be a modifier like I thought it would be, like "int" or "String".

I've reached another stump. Maybe I'm missing something?
9 years ago
I am now realizing that hasNextBigDecimal is not the right way to go about this.

But how do I make the program accept a number with a colon in it? No matter what type of data type I use it will not accept any of the colon numbers. Even double will not allow the program to take it.
9 years ago
I am still having a hard time figuring out how to make the program allow me to type in any kind of digit. It's easy for me to declare a single, set variable. But I cannot figure out how to have it just accept any type of value I type in?
9 years ago
So would I use the substring class in this program?
9 years ago
Ah ah, I actually do believe that parse.Int might work for me. I will try that out and play around with it a bit.

Here is my problem written in plain English (not Java code :P) for assistance in reading what I wish to accomplish:

1. Need to have the program print the text: "Enter marathon target time:"

2. Need to have the program take an input number with a colon format for hour:minute minute. Must be able to accept a number with a colon in it.

3. Program must convert the hours of the inputted number of the total marathon time to minutes, and the minutes to seconds so that it is in M:SS format.

4. To convert, have program divide the hours by 60 for minutes. Then, divide the minutes by 60 for seconds.

5. Finally, have the program print the line "Mile Pace:" with the converted time variable after it.
9 years ago