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

Update vehicle purchase instructions to be more clear #820

Merged
merged 3 commits into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions exercises/concept/vehicle-purchase/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ You have three tasks, one to determine if you will need one to help you choose b
The auto dealers in your town are all running a five year, 0% interest promotion that you would like to take advantage of.
But you are not sure if you can afford the monthly payments on the car you want.

The monthly payment is the cars total price divided by the number of months under the five year period.

Implement the `canIBuy(vehicle:price:monthlyBudget:)` function that takes the following arguments:
- `vehicle` - The name of the vehicle you want to buy.
- `price` - The price of the vehicle you want to buy.
- `monthlyBudget` - The amount of money you can afford to pay each month.

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"`.
- If the monthly payment of the vehicle is less than or equal to the monthly budget, return the message `"Yes! I'm getting a <vehicle>"`.
- If the monthly payment of the vehicle is above your monthly budget by up to 10% (inclusive), return the message `"I'll have to be frugal if I want a <vehicle>"`.
- If the monthly payment of the vehicle is more than 10% above your monthly budget, return the message `"Darn! No <vehicle> for me"`.

```swift
canIBuy(vehicle: "1974 Ford Pinto", price: 516.32, monthlyBudget: 100.00)
Expand Down