Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![David Rodriguez Saavedra](https://uploads.teamtreehouse.com/production/profile-photos/3183812/micro_Foto_del_d_a_14-08-15_a_las_7.59_p.m..jpg)
David Rodriguez Saavedra
3,574 Pointswhat value should i give to var taxes?
please some one help!!
struct Expense {
var description: String
var amount: Double = 0.0
init (description: String) {
self.description = description
}
func calculateTaxes(percentage: Double) -> Double{
return self.amount * (percentage/100.00)
}
}
var item = Expense(description: "hello")
item.amount = 7.5
item.calculateTaxes(percentage: Double)
var taxes = calculateTaxes(percentage)
1 Answer
![Chase Marchione](https://secure.gravatar.com/avatar/2b3a4eb00836bc9ba2829e89937cf5f4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Chase Marchione
155,055 PointsHi David,
Challenge 3 asks us to set item.amount to 100, so we'll do that.
As for Challenge 4, we'll pass in 7.5 as an argument to the calculateTaxes method (this 7.5 will be the tax percentage, as you've defined in the calculateTaxes method's header.) We need to specify our variable of item when calling this method (which is an instance of Expense), because item's amount property holds the value that we want to calculate taxes on.
var item = Expense(description: "hello")
item.amount = 100
var taxes = item.calculateTaxes(7.5)
Hope this helps!