Skip to main content
deleted 476 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391

Choose the right names

The name HW3_DollarValuOfCoinsInvestmentCompoundedAnnually is not great. For one thing, class names in Java should use CamelCase, which is violated by the _ there.

The current name includes the 2 purposes used in the class:

  1. Calculate the dollar value of coins
  2. Calculate the compound interest

Since these are completely different things, either split the class into 2 separate classes, or give it a more generic name.

Choose the right names

The name HW3_DollarValuOfCoinsInvestmentCompoundedAnnually is not great. For one thing, class names in Java should use CamelCase, which is violated by the _ there.

The current name includes the 2 purposes used in the class:

  1. Calculate the dollar value of coins
  2. Calculate the compound interest

Since these are completely different things, either split the class into 2 separate classes, or give it a more generic name.

added 5 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391

Putting it togetherSuggested implementation

Putting it together

Suggested implementation

added 464 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391

Suggested implementationPutting it together

Putting the above suggestions together, something like this would be better:

Suggested implementation

Putting the above suggestions together:

Putting it together

Putting the above suggestions together, something like this would be better:

added 464 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391
Loading
added 464 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391
Loading
added 464 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391
Loading
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391
Loading