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

Custom Exception for incrementSales() or incrementCosts() methods #1

Open
ichervachidze opened this issue Jan 8, 2021 · 1 comment

Comments

@ichervachidze
Copy link
Owner

Both methods throw illegal argument exception. Create a custom exception for either (or both) method(s).

Where to find

Iteration 3, Inventory package, class Shop

incrementSales() method:

public void incrementSales(double increment) {
	if (increment < 0) throw new IllegalArgumentException();
	else this.sales += increment;
	}

incrementCosts() method:

//Increments costs by given amount
public void incrementCosts(double increment) {
	if (increment < 0) throw new IllegalArgumentException();
	else this.costs += increment;
       }

What to do

Create a custom exception with a descriptive name, such as NegativeSalesException/NegativeCostsException.

@pmcder
Copy link
Contributor

pmcder commented Jan 9, 2021

I will work on both of these. Do you want them in this same package ?

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

No branches or pull requests

2 participants