reset password
Author Message
velder0
Posts: 16
Posted 09:12 Jun 02, 2016 |

I'm having a problem printing the return values for my table.

I have the two first questions in main, but then i made individual methods for the user inputs for the cost and amount of elements.

When I try calling the method, instead of printing the return value it re-asks the user the print statement in my method. 

Should I ask all the user inputs in the main method instead of making separate methods for each input?

 

rcamach7
Posts: 31
Posted 09:36 Jun 02, 2016 |

Yeah you should probably have all user inputed data called on/asked for on main.

What I did for the third question was create the single array and initialize it there, rather than in a method. I did the same for filling in the values for the 2d array. 

I then created methods for printing the different parts of the tables using all the data that was given.

Last edited by rcamach7 at 09:37 Jun 02, 2016.
velder0
Posts: 16
Posted 10:25 Jun 02, 2016 |

got it!

Now I am having an issue printing the column size when showing cost per unit.

Whats a hint to count the column size like 1 2 3 4 5 instead of just printing 5?

I tried looping it but it ended up printing 555

velder0
Posts: 16
Posted 10:30 Jun 02, 2016 |

nvm got it!

velder0
Posts: 16
Posted 12:19 Jun 02, 2016 |

should the number of components be a string?

because when I try to print the 2D array it outputs this

 

10 

 

12 

 

9

 

I don't know why it adds extra 0's

velder0
Posts: 16
Posted 12:24 Jun 02, 2016 |

never mind fixed it haha