Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Wait a minute .....
First the bus can transport 50 people, the number of seats are never defined and 126-50 doesn't make 24 wtf -
Outsourcing homework to disgruntled programmers in a rant forum?
24 is the result of 50 minus 126 mod 50, you figure out the rest. -
@jackpearce I had the same thought and was confused.
However @Aman15 devRant is not a homework service. -
@jackpearce The bus can transport 50 people at once, that's the number of seats. The exercise is asking to calculate the number of _free seats_ in the _last_ bus.
-
Usually the hardest part in assignments like this is reading the assignment correctly.
-
@ethernetzero well I use the bus everyday and trust me the number of seats does not define how many people are in the bus/train/tram/subway
especially with the 9€ ticket in germany (that was horrible)
But jokes aside thank you for the explanation ^^' now I notice the keyword LAST bus -
@jackpearce Your real life experience is not relevant to the theoretical exercise presented to the OP. The problem says the bus can carry 50 people, you don't need any more details.
-
That will be $15: https://ko-fi.com/lbfalvy
Also, if you send any existing code that you have, I can make sure it looks similar. It's very easy to get caught outsourcing homework if your code has a different style on every submission. -
Oh its you asshole again. Mr. "I'm too arrogant to even ask people to help me I just list my babys-first programming question here and just expect people to give me the answer"
Go fuck yourself -
@ethernetzero technically the question is unsolvable since it is not mentioned how many seats there are if any. It's also not mentioned if all seats can be used to carry passengers at the same time. Also, many people choose to travel standing even if there are free seats, so it is also a valid assumption to make.
Imo any result should be accepted as correct, as long as it's calculated in the program with some logic and printed out in the end. That's the thing the student expected to learn on this beginner course anyway. -
max199313702yClassic binpacking with binsize of 50 and 126 elements to be packed, print back the amount of usage of the last bin.
126 - 50 = 76
76 - 50 = 26
26 is NOT 24. -
Well, if that was a realistic scenario, the difficult part would be to come up with a way to reliably detect the number of people in the bus or in a seat. 😛
-
@max19931 I actually think it's a scheduling problem with concurrency, since the buses all arrive at different times /s
-
Grumm18242y@max19931 You miss the 'empty seats' part.
Yes only 26 people will be on the last bus so 50-26 = 24 empty spots.
Seems like reading the question will be a great start for many here. -
@max19931 The problem is not asking for the amount of usage of the last bin, but the opposite.
-
@electrineer And what if the bus crashed on its second trip? Or if the driver was fired or called in sick before starting?
Too many variables. -
So, just to recap a solution for @Aman15:
You need to input the following variables:
- Location of the bus stop
- Destination of the bus trip
- How many people are waiting at the bus stop
- How many people will have forgotten something at home and not catch the bus
- How many buses there are
- The medical history of each one of the bus drivers
- What did they have for breakfast/lunch/dinner
- How many broken or gross seats are there on each bus
- Space for people standing
- The starting date and time of the first trip, if applicable
- The traffic and road condition data for that time range
- The weather report for that date/time range
- The condition of all of the parts from each bus
- If buses keep going to the bus stop even after there aren't any more people waiting there, in which case you'll also have to ask for
- The ending datetime
Then you calculate the number of free seats in the bus that last departs from the bus stop by simulating each trip in parallel. -
@electrineer I'm just providing @Aman15 with the totally legit answer he wants us to provide to his homework. ;)
-
Grumm18242y@ethernetzero But those variables do not matter on for the last trip.
1) second bus crashed
a) all people already got on the bus before the crash => no problem
b) people are not on the bus, new bus comes as a replacement and all 50 get on that bus.
2) driver fired or called sick
a) goto condition 1.b -
@Grumm That's why you need the number of buses, because there could be just one, and the medical history of the drivers and the condition of the buses' parts, the weather, the traffic data, so you calculate if there will be a crash or if any drivers will call in sick.
Also, more than one bus could crash. -
Grumm18242y@ethernetzero sure, but based on the question who mention a 'bus service', I do hope that they have more than 1 bus.
Maybe some neural networking can be a good solution too for the problem ? :D
C++ coding question
question