0

Can anyone please help me with this solving this code in Java Script

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 need to write a function called publicBusFare that will take a number (how many passengers) as a parameter. It will return you the total amount of public bus fare. Example 1: If 117 people go for picnic then we need 2 buses and 1 microbus. The rest of the people will go by public bus. The total public bus fare for these people should be returned.

10th Aug 2022, 5:04 PM
SRD
2 ответов
+ 1
It's a cool project. What have you done so far? Where does your code go wrong? Post it here and someone can help you.
10th Aug 2022, 5:36 PM
Ausgrindtube
Ausgrindtube - avatar
0
Let bus = 60; Let smallBus = 30; Let publicBus = 40; Function getPublic(people: int){ If (people >= (bus* 2) + smallBus){ Let allSeats = (bus*2) + smallBus; Let missedSeats = people- allSeats; Console.log(„people that need public bus: „ + missedSeats); } } getPublic(126); May that is what you want, sorrx for messy up a bit, i wrote this on a iPad… and that is more that stupid … 😀😀✌️
10th Aug 2022, 9:09 PM
S3R43o3
S3R43o3 - avatar