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 (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Thomas
11 January 2023, 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 2023, 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 2023, 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