Transportation coding help, please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Transportation coding help, please.

I'm fairly new to this app but have had some experience coding with C but I can't get a good answer to the Transportation project. I understand that % gives the remainder and understand the 25 % 7 = 4 example but I just can't figure out how to code this project without if/then or for/next but they haven't been introduced at this point in the course so I'm assuming there IS a way to do this without them. I DON'T WANT YOU TO GIVE ME THE ANSWER, but could you point me in the right direction, PLEEEEEASE!!?

25th Jan 2022, 12:55 AM
Gareth Crawshaw
4 Answers
+ 3
You have to calculate the number of empty seats in the last bus. That's 50 seats minus the number of people who did not fit into the second to last bus.
25th Jan 2022, 12:59 AM
Simon Sauter
Simon Sauter - avatar
+ 1
The remainder doesn't give you the number of empty seats. It gives you the number of people who don't fit into the second to last bus. So the number of empty seats is 50 minus the remainder.
26th Jan 2022, 7:13 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Thank you again, Simon. I was just looking at the code and I very honestly realised my error as you just pointed out. I just did another variable, subtotal then EmptySeats = load - subtotal and it worked!!!! I can't really believe I got so frustrated by such a simple missing step. I swear that I did suss it out myself but many, many thanks for your help!!😁
26th Jan 2022, 7:17 PM
Gareth Crawshaw
0
OK, I get that you're meant to calculate the empty seats. I've set up int load=50, int total and int EmptySeat variables but when I run EmptySeats = total % load it just keeps failing the test inputs that the course inputs. That's what's driving me mad. To my mind "total % load" is just the same as 25 % 7 and the program should then output the remainder which would be the empty seats on the last bloody bus!! Thanks for your input😀
26th Jan 2022, 7:10 PM
Gareth Crawshaw