#does anyone know how to fix this code
1 messages ยท Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Here is an AI assisted attempt to answer your question ๐ค. Maybe it helps! In any case, a human is on the way ๐. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
Without seeing the code, it is difficult to provide a specific solution. However, here are some general steps you can follow to fix the issue:
-
Check if the discount calculation is correct: Make sure that the discount calculation is accurate and returns the expected value. Verify that the discount percentage is being applied correctly to the original amount.
-
Check if the data types are correct: Ensure that all variables used in the calculations have appropriate data types. For example, if you are working with decimal numbers, use
doubleinstead ofintto avoid truncation or rounding errors. -
Verify if the output formatting is correct: Check if the code includes proper formatting for outputting decimal values. You may need to use
DecimalFormatorString.format()to format the output as desired. -
Debug and print intermediate values: Insert print statements or use a debugger to check intermediate values during execution. This will help identify any unexpected changes or errors in calculations.
-
Consider edge cases: Test your code with different input values, including edge cases such as zero amounts or maximum discounts, to ensure it handles all scenarios correctly.
If you can provide more details about your code and specific issues you are facing, it would be easier to provide a more targeted solution.
0 * anything = 0
initialize amount variable first
btw i think you forgot you made amount a public private
not public
never do this
make a getter and setter method
jake chu really did you dirty like that

this is supposed to be user inputted not hardcoded