r/learnjava • u/LocalPedo • Oct 08 '17
Programing Assignment Help
My professor doesn't teach us since she expects us to know how to do everything although I'm taking an intro class in java. Anyway, any help is appreciated. This is the assignment itself https://imgur.com/a/iT0Wq I have some ideas on how to do this problem but no way of actually knowing how to do them because of my professor. This is a link to the code I wrote on pastebin https://pastebin.com/GjUiZnnb. I tried to make one array with the entire input but the space is considered another input instead of a white space. There's a lot that needs to be done and I don't really know where to even start. Any help is super appreciated, thanks.
1
Upvotes
1
u/mrs_frizzle Oct 09 '17
Your ppl variable tells you how many times to run the loop. Not sure why you incremented it on the next line?
For example, if I tell the program to expect 3 lines, I could write:
3 Student Grade Student2 Grade2 Student3 Grade3
Your program reads in the 3 and saves it as "ppl". So: while(ppl > 0) { Do your code
ppl-- }
Every time it finishes a line of input it will take one away from the loop counter, and stop with the last line of input. Not sure why you made each line an array?
You will use "printf" for the formatting, such as the padded zeros and alignment. Good luck.