Skip to content

Feedback#1

Open
github-classroom[bot] wants to merge 4 commits intofeedbackfrom
main
Open

Feedback#1
github-classroom[bot] wants to merge 4 commits intofeedbackfrom
main

Conversation

@github-classroom
Copy link

@github-classroom github-classroom bot commented Feb 5, 2026

👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to the default branch since the assignment started. Your teacher can see this too.

Notes for teachers

Use this PR to leave feedback. Here are some tips:

  • Click the Files changed tab to see all of the changes pushed to the default branch since the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue + (plus sign). To learn more about comments, read “Commenting on a pull request”.
  • Click the Commits tab to see the commits pushed to the default branch. Click a commit to see specific changes.
  • If you turned on autograding, then click the Checks tab to see the results.
  • This page is an overview. It shows commits, line comments, and general comments. You can leave a general comment below.
    For more information about this pull request, read “Leaving assignment feedback in GitHub”.

Subscribed: @mckayhowell

// Initialize a list to store the names of high paid employees
List<String> highPaidEmployees = new List<String>();

final Integer HIGH_SALARY = 55000;

Check warning

Code scanning / PMD

The final local variable name 'HIGH_SALARY' doesn't match '[a-z][a-zA-Z0-9]*' Warning

The final local variable name 'HIGH_SALARY' doesn't match '[a-z][a-zA-Z0-9]*'
Copy link

@walters954 walters954 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Work, McKay! 🎉

Congratulations on completing Module 2! You've demonstrated a solid understanding of flow control, loops, and collections in Apex.

What You Did Well

  1. Null Handling: You consistently checked for null values before processing (e.g., in helloWorld, findMax, checkNumber). This defensive programming approach prevents runtime errors - a crucial skill in Salesforce development.

  2. Proper Use of Jump Statements: Your use of continue in sumPositiveIntegers and break in findWordInList shows you understand how to control loop execution effectively.

  3. Clean Code Practices: I noticed you used constants like STOP_VALUE and HIGH_SALARY instead of magic numbers. This makes your code more readable and maintainable - excellent habit!

  4. Good Comments: Adding explanatory comments (like noting that list indices start at 0) shows you're thinking about code clarity.

  5. Collection Mastery: You correctly worked with Lists, Sets, and Maps, demonstrating understanding of when to use each collection type.

Suggestions for Growth

I've left a few inline comments with tips for optimization and alternative approaches. These aren't corrections - your solutions work perfectly! They're just professional patterns you might find useful as you continue your Salesforce journey.

Keep up the excellent work! You're building a strong foundation in Apex programming. 💪

if (a == null) {
return 'Null';
} else if (a == '') {
return 'Empty';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work using String.isEmpty() alternative logic here! For future reference, Apex provides a handy String.isBlank() method that checks for both null and empty strings in one call. You could simplify this to:

if (String.isBlank(a)) {
    return a == null ? 'Null' : 'Empty';
} else {
    return 'Contains Text';
}

That said, your current implementation is perfectly correct and clear - just a tip for the future!

final Decimal STOP_VALUE = 40.0;
Decimal total = 0.0;
for (Decimal money : moneyInWallet){
if(total <= STOP_VALUE){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of a constant (STOP_VALUE) here - that's a professional practice that makes code more readable and maintainable!

One small optimization: you could use break to exit the loop once you've exceeded 40, rather than continuing to iterate through the remaining items:

for (Decimal money : moneyInWallet){
    total += money;
    if(total > STOP_VALUE){
        break;
    }
}

This would be more efficient for larger lists since it stops processing once the condition is met. Your current solution works correctly though!

//add strings to the set
//add strings to the set - sets cannot contain duplicate values so adding same values does not affect string
for (String input : inputList){
stringSet.add(input);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent use of a Set to remove duplicates! Your comment explaining that "sets cannot contain duplicate values" shows you understand the concept well.

Pro tip: You can also initialize a Set directly from a List in one line:

Set<String> stringSet = new Set<String>(inputList);

This is a common Apex pattern for deduplication. Your loop approach is great for learning how Sets work though!

Integer sum = 0;
// Loop through the list of integers
for(Integer num : numbers){
// if the number is negative skip this iteration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job using continue to skip negative numbers! This demonstrates you understand jump statements well.

I love that you're using a for-each loop here - it's cleaner and more readable than a traditional for loop when you don't need the index.

List<Decimal> moneyInWallet = new List<Decimal>{0.50, 10, 3.84, 24.60, 9.08, 50, 4.90}; //DO NOT CHANGE

return null; // Replace null with the variable you used to store the result
final Decimal STOP_VALUE = 40.0;

Check warning

Code scanning / PMD

The final local variable name 'STOP_VALUE' doesn't match '[a-z][a-zA-Z0-9]*' Warning

The final local variable name 'STOP_VALUE' doesn't match '[a-z][a-zA-Z0-9]*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants