Carey Brown

Bartender
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
Forum Moderator
Carey Brown currently moderates these forums:
Cows and Likes
Cows
Total received
50
In last 30 days
0
Total given
2
Likes
Total received
800
Received in last 30 days
24
Total given
105
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

Pete Letkeman wrote:Is there a limitation as to how long a directory name can be according to Java?

Yes there is. At least, a pre-Win10 Windows operating system had a file name path of 4k characters. You're not anywhere close to that so you'll have to look elsewhere for the problem.
15 hours ago

Tim Moores wrote:

unless we're talking about a fixed width font, which .txt files usually are.


That is a feature of the viewer application. The file itself -which is being created here- can't do anything about that.

The OP posted a screen snapshot of his file being displayed. In this case we're talking about fixed width.

Can you describe a case where an OS opens a .txt file with the default app that uses proportional font? That is, when you double click on the .txt file name.
19 hours ago

Tim Moores wrote:Text files have no formatting. You could add spaces in front of the title to move it right, but whether that moves it exactly into the center depends on the font type, the font size, and the page size. It'll likely not come out the way you want it to, so you may be better off focusing on something else.

True, unless we're talking about a fixed width font, which .txt files usually are.
20 hours ago
--or--
20 hours ago
The center of what? The longest line other than the title? Or the center of a predetermined page width, say 60? Or the center of the line immediately following title? What if the title is the longest line?

If you are familiar with ArrayList I would use that to temporarily hold all the lines (without printing them yet). Then you can loop through the list to find the length of the longest line. You can then loop through the lines again but this time print them using the longest length to center whatever other lines you want.
20 hours ago
You could just pass in the name.

1 day ago
For instance, according to the instructions, this
should be
per

Create a class named TestLease whose main() method declares four Lease
objects. Call a getData() method three times. Within the method, prompt a user
for values for each field for a Lease , and return a Lease object to the main()
method where it is assigned to one of main() ’s Lease objects.
1 day ago

Campbell Ritchie wrote:

Maurizio Gasparro wrote:. . . do: create fields: aptTenName; aptNum; monRent; terOfLease;

You are going to have to create fields with those names, even though I think they are poor names. They are difficult to read out and they do no t make it clear what they mean. Be sure to use exactly the spelling you have been given.


The requirements don't specify those names. In fact, they refer things like "apartment  number", which in Java camel-case should be "apartmentNumber".
2 days ago
--OR--
You could pass the local name variable as a parameter to the goodbye() method.

Note that method and variable names should begin with a lower case letter.
2 days ago
Where do you create getData()?
What is getData() supposed to do?
What, if anything, is getData() supposed to return?
What, if anything, does getData() need to be passed in as parameters?
At what point is getData() called?
Is getData() called more than once?
Where, if anywhere, is the returned value, if any, assigned from getData()?

Similar question for the showValues() method.
2 days ago
I agree with the above comments about verbosity. Perhaps this is a test to see if the student can follow instructions. This snippet of the instructions bother me because I would see something named "getData()" to be some form of getter. I might have named it inputLease() or createLease(). Regardless, the instructions can be followed as is. We can already see that if the OP continues on his current path that he'll end up with redundant input code. Making a getData() method would correct that.

Call a getData() method three times. Within the method, prompt a user for values for each field for a Lease , and return a Lease object to the main() method where it is assigned to one of main() ’s Lease objects.

2 days ago
You are correct about newRent, the value gets thrown away. Your requirements don't say anything about returning a value.

You are missing a lot of what has been described in the second half of the requirements, specifically, the implementation of two methods and the calling of those methods.
3 days ago
In terms of graphics, they are more typically referred to as width and height.
3 days ago
Validate in constructor and throw an exception.
4 days ago
Ah, line 31 change made all the difference. I still had it as the OP's nextLine() vs your nextInt(). Thanks for the post.
5 days ago