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

diamondProblemSolver #612

Merged
merged 4 commits into from
Oct 31, 2023
Merged

Conversation

Alfred-hhy
Copy link
Contributor

Issue Id: #591

Briefly explain your program logic:
This React component is a Diamond Problem Solver. It takes two factors as input, calculates their product and sum, and displays the results. The calculations are updated whenever the input factors change. It also includes basic input validation.

Screenshots:
image
image

By raising this PR I affirm that -

  • My code follows the guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code.
  • My code gives the correct output.
  • I affirm that I strictly follow contributing guidelines and code of conduct.

@SarthakKeshari
Copy link
Owner

@Alfred-hhy,
Kindly re-read the calculation functionality description in the issue

@Alfred-hhy
Copy link
Contributor Author

@SarthakKeshari
Please review the modified pull request once again.
Issue Id: #612

Briefly explain your program logic:

  1. State Variables: The component uses the useState hook to manage state variables for a, b, product, sum, equationSteps, and calculateButtonClicked.
  2. Input Validation: The isInteger function checks if a given value is an integer using a regular expression.
  3. Effect Hook: The useEffect hook is used to calculate values and update equation steps whenever there is a change in the state variables (a, b, product, sum, calculateButtonClicked).
  4. Input Change Handling: The handleInputChange function is triggered on input changes. It updates the state variables based on the input type (a, b, product, sum). It also recalculates sum and product based on valid inputs.
  5. Calculation Functions: The calculateValues function performs calculations based on the input values, updating the state variables and equation steps accordingly. It covers various scenarios to solve the Diamond Problem.
  6. Button Click Handling: The handleCalculate function sets calculateButtonClicked to true, triggering the recalculation in the useEffect hook.
  7. Equation Solving: The findNumbers function calculates values for a and b given the product and sum. It uses the quadratic formula and updates the equation steps.
  8. Rendering: The component renders a UI with Material-UI components, including text fields for input, buttons to trigger actions, and a display of equation steps.

Screenshots:
image
image

By raising this PR I affirm that -

  • My code follows the guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code.
  • My code gives the correct output.
  • I affirm that I strictly follow contributing guidelines and code of conduct.

@SarthakKeshari SarthakKeshari self-assigned this Oct 31, 2023
@SarthakKeshari
Copy link
Owner

@Alfred-hhy,
Kindly revert all package-lock.json and push the code again

@Alfred-hhy
Copy link
Contributor Author

"Sure, I'll revert the package-lock.json and push the code again. Will keep you posted once it's done!"

@Alfred-hhy
Copy link
Contributor Author

@SarthakKeshari
I have'already revert all package-lock.json.

@SarthakKeshari
Copy link
Owner

@Alfred-hhy,
Good work. I can find the PR updated now.

Thankyou

@Alfred-hhy
Copy link
Contributor Author

@SarthakKeshari
I also recently started contributing to GitHub by making pull requests. Thank you for assigning tasks to me, responding quickly, and being understanding of the mistakes I made earlier.

Sincerely grateful.

@SarthakKeshari SarthakKeshari added easy Easy Level Calculator - 5 points hacktoberfest2023 Under Hacktoberfest 2023 hacktoberfest-accepted labels Oct 31, 2023
@SarthakKeshari SarthakKeshari linked an issue Oct 31, 2023 that may be closed by this pull request
12 tasks
@SarthakKeshari SarthakKeshari merged commit eab6e4a into SarthakKeshari:master Oct 31, 2023
1 check passed
@SarthakKeshari
Copy link
Owner

Congratulations 🎉 @Alfred-hhy on your contribution.
Thanks for adding value to this repository. 😊

Let's celebrate this fest 😃 by providing more developers 👨‍💻👩‍💻 an opportunity to contribute. Help us make this repository reach far and more by sharing this to your friends and colleagues.

Your efforts can make difference.

@SarthakKeshari
Copy link
Owner

Hey 👋, may you also encourage us by clicking the star icon on the repository main page. ⭐

image

@Alfred-hhy
Copy link
Contributor Author

@SarthakKeshari
🎉 Thank you so much for the warm congratulations! I'm thrilled to be a part of this project and contribute to its growth. 😊

Absolutely, 🚀 I've already shared it with my friends and colleagues, and I'll continue to do so.

And of course, ⭐️ clicked! Your encouragement means a lot. 💪👨‍💻👩‍💻

@SarthakKeshari
Copy link
Owner

@Alfred-hhy,
Thank you so much.

@SarthakKeshari SarthakKeshari added the 🎉ranked Ranklist updated for this merge label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Easy Level Calculator - 5 points hacktoberfest2023 Under Hacktoberfest 2023 hacktoberfest-accepted 🎉ranked Ranklist updated for this merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diamond Problem Solver
2 participants