Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in conditionals/vehicle-purchase? #810

Open
rhoot opened this issue Dec 25, 2024 · 0 comments
Open

Errors in conditionals/vehicle-purchase? #810

rhoot opened this issue Dec 25, 2024 · 0 comments

Comments

@rhoot
Copy link

rhoot commented Dec 25, 2024

Going over the conditionals exercise (vehicle-purchase), it has these two tests:

XCTAssertEqual(
canIBuy(vehicle: "1974 Ford Pinto", price: 516.32, monthlyBudget: 100.00),
"Yes! I'm getting a 1974 Ford Pinto")

XCTAssertEqual(
canIBuy(vehicle: "2020 Indian FTR 1200", price: 12_500, monthlyBudget: 200),
"I'll have to be frugal if I want a 2020 Indian FTR 1200")

But the instructions say:

The function should return the following message based on the following conditions:

  • If the price of the vehicle is less than or equal to the monthly budget, return the message "Yes! I'm getting a <vehicle>".
  • If the price of the vehicle is 10% above your monthly budget, return the message "I'll have to be frugal if I want a <vehicle>".
  • If the price of the vehicle is more than 10% above your monthly budget, return the message "Darn! No <vehicle> for me".

516.32 is more than 10% above the monthly budget (100), so it shouldn't say yes. Likewise, 12,500 is quite a bit more than 10% over the monthly budget of 200, so it shouldn't say you have to be frugal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant