I have a problem with a java problem. The problem is,
You have a input file called climb.dat, inside the data file is:
3
2
5
8
The output is to have a left angled triangle with the data. One thing I do know is that the first number,(3), is how many left angled triangles and every triangle is supposed to be made up of a character which is c. How its supposed to look like is like this:
c
cc
c
cc
ccc
cccc
ccccc
c
cc
ccc
cccc
ccccc
cccccc
ccccccc
cccccccc
I don't how to solve this problem.
I need help!!
alejandro martinez
Level 1
Java problem called climb (not from the website)
Resolved
Comments (7)
- Popular
- New
- Old
You must be signed in to leave a comment
Harry Graham
13 January, 02:23
I have really lived in the dark for so long and I know there are so many people out there who are currently in this same darkness. I would have just lost $28,000 in my combined crypto wallets just because I forgot my login credentials. Cyber Retrieve recovery was that shining light in my darkness, and today I have been able to recover all my credentials. I didn't only recover my funds but I have a wallet balance of $85,000 today and growing.
> cyberetrieve @ mail.com
0
Hurry Morgan
12 January, 11:26
My Bitcoin Investment Experience. No doubt Bitcoin has been the trend of today and it's doing a lot in the world of business because people prefer saving up money in their wallets rather than banks, I lost about $54,000 USD last summer due to the fall in the price of bitcoins. A colleague at work who knew my ordeal on bitcoin savings introduced me to a platform (protocol investment & recovery service) where I can save and invest my bitcoins with more than 100% profit margin. At first I was skeptical about it so I decided to try it out with just a few dollars. I was amazed after 12 hours I earned more than 50% additional dollars and I was able to make an instant withdrawal and ever since I have been investing and making more money. Bitcoin investment with protocol crypto investment and recovery service has changed my life as I have made over $176,000 USD. You can sign up and earn at: https:// protocolcryptoinvestment .com or contact info protocolrecoveryservice (@) Gmail .com for more details. Note: NO REGISTRATION FEE, NO UPFRONT PAYMENT.Enjoy endless possibilities.
0
Thomas
11 January, 07:52useful
are you sure about the first number? My guess would have been it represents the char to output in the triangles.
+1
alejandro martinez
11 January, 22:56
Hi Thomas, as for your question, yes I am sure about the first number. I also tried your code and it's giving me an error saying "the target type of this expression must be a functional interface".
0
Thomas
12 January, 07:27
the necessary imports:
You also can change the way of reading the file to what you're familiar with. It just reads the file, converts each line to an Integer, adds it to a list and finally returns that list.
The first number imho is then a redundant information (?) as the following numbers each represents a triangle. In that case you can just ignore it or (but why when there is no additional content in the file) use it in the read loop to read a specific amount of lines/ numbers. 0
Alex
12 January, 21:32
it is giving me an error in the part that goes, " return lines.map(Integer::parseInt "
0
Thomas
12 January, 21:48
I've tested this with Java 8, 17 and 19
so either use correct imports (as written above)
or one of the alternatives I described (again see my 2nd post here)
or instead of a method reference use a lambda like
then there is no chance of an ambiguous call.
(best would be to use the alternative in my second post) 0