JavaScript problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JavaScript problem

I am a beginner in JavaScript coding, so I am facing many issues in solving this problem. Each time I try it does not match the solution. The problem is : #A large number of people will go for a picnic. The number of buses will depend on the number of people. Suppose we have buses and micros. Each bus has a capacity of 50 people and each microbus has a capacity of 11 people and each public bus ticket costs 250 rupees. Now you have to write a function called publicBusFare which will take a number (how many passengers) as a parameter. It will return you the total amount of public bus fare.

9th Sep 2022, 5:49 AM
Jubair sultan
6 Answers
+ 5
Jubair sultan the obvious would be total passengers * 250 rupees. I actually took your question and made a php example. https://code.sololearn.com/wZ85k3ieLwO2/?ref=app
9th Sep 2022, 3:37 PM
BroFar
BroFar - avatar
+ 3
It sounds like you have a few attempts that you can share, write them into the code playground and attach it here. It could be a simple typo or a coding error, maybe it's your logic, as Yaroslav Vernigora said.
9th Sep 2022, 2:04 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Hi! what are your thoughts on this assignment? how can you count the empty seats of passengers on the last bus?
9th Sep 2022, 5:52 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
I apologize, I have not carefully read the condition of the task. I thought this task about the bus, empty seats and passengers. and here the condition of the problem is different, I can be mistaken or misleading
9th Sep 2022, 2:58 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
in any case, show us your attempt to encode this problem
9th Sep 2022, 4:16 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
If 235 people go to a picnic then we need 4 buses and 3 microbuses and the rest people will go by public bus. The total public bus fare for these few people should be returned.
9th Sep 2022, 6:09 AM
Jubair sultan