-
-
Notifications
You must be signed in to change notification settings - Fork 713
Add solution for Challenge 18 by Johrespi #651
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
Conversation
WalkthroughThis change introduces a new Go program implementing temperature conversion utilities in a submission file. It includes CelsiusToFahrenheit and FahrenheitToCelsius conversion functions, a Round helper for decimal precision, and a main function demonstrating their usage with print statements. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
challenge-18/submissions/Johrespi/solution-template.go (2)
19-25: Remove obsolete TODO comments and consider simplifying type conversions.The implementation is correct, but the TODO comments should be removed since the function is now complete. Additionally, the explicit
float64()conversions can be simplified by using float literals.Apply this diff to clean up the code:
// CelsiusToFahrenheit converts a temperature from Celsius to Fahrenheit // Formula: F = C × 9/5 + 32 func CelsiusToFahrenheit(celsius float64) float64 { - // TODO: Implement this function - // Remember to round to 2 decimal places - return Round(celsius * (float64(9) / float64(5)) + float64(32), 2) + return Round(celsius*9.0/5.0+32, 2) }
27-33: Remove obsolete TODO comments and consider simplifying type conversions.The implementation is correct, but the TODO comments should be removed since the function is now complete. Additionally, the explicit
float64()conversions can be simplified by using float literals.Apply this diff to clean up the code:
// FahrenheitToCelsius converts a temperature from Fahrenheit to Celsius // Formula: C = (F - 32) × 5/9 func FahrenheitToCelsius(fahrenheit float64) float64 { - // TODO: Implement this function - // Remember to round to 2 decimal places - return Round((fahrenheit - float64(32)) * float64(5) / float64(9), 2) + return Round((fahrenheit-32)*5.0/9.0, 2) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
challenge-18/submissions/Johrespi/solution-template.go(1 hunks)
🔇 Additional comments (2)
challenge-18/submissions/Johrespi/solution-template.go (2)
8-17: LGTM!The example usage clearly demonstrates both conversion functions with appropriate test values.
35-39: LGTM!The rounding implementation is clean and correct, using the appropriate
mathpackage functions.
Challenge 18 Solution
Submitted by: @Johrespi
Challenge: Challenge 18
Description
This PR contains my solution for Challenge 18.
Changes
challenge-18/submissions/Johrespi/solution-template.goTesting
Thank you for reviewing my submission! 🚀