This community-built FAQ covers the “Multiplication and Division” exercise from the lesson “Learn Java: Manipulating Variables”.

**Paths and Courses**

This exercise can be found in the following Codecademy content:

Learn Java

##
FAQs on the exercise *Multiplication and Division*

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. **Ask or answer a question by clicking ***reply* () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

##
Join the Discussion. Help a fellow learner on their journey.

**Ask or answer a question** about this exercise by clicking **reply** () below!

Agree with a comment or answer? **Like** () to up-vote the contribution!

Need **broader help or resources**? Head here.

Looking for motivation to keep learning? Join our **wider discussions**.

**Learn more** about how to use this guide.

Found a **bug**? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

This lesson assumes everyone knows how to calculate percentages. I didn’t know how to do this without looking it up. For this exercise, what is meant by ‘tax’ is the tax rate percentage (.0875), NOT the actual total amount of tax someone is paying. Thus, the total amount of tax being paid needs to be calculated ex. subtotal*tax

The lesson also doesn’t teach if there are any rules regarding calculating multiple numbers together at once so I just had to guess that they could all be calculated together.

Solution for instruction 1. : double total = subtotal + subtotal*tax;

System.out.println (total);

12 Likes

The lesson doesn’t teach that you can do multiple operations at once; or even that you can use parantheses to override order of operations if needed, which is what you should do in this case (not needed, but definitely would make more sense). Change the question, maybe make it subtotal + tip instead of tax

1 Like

Thank you for you comment. I’m in the same boat when it comes to calculating percentages and your comment really clarified the assignment. They did a poor job with this one.

1 Like

The lesson states “product of” which is multiplying. Gotta remember that next time!

2 Likes

Very sloppy work on this page. Alot of assumptions and not at all clear.

I hope someone sees this comment and revises this exercise.

public class MultAndDivide {

public static void main(String args) {

```
double subtotal = 30;
double tax = 0.0875;
double total = subtotal + subtotal*tax;
System.out.println(total);
double perPerson = total/4;
System.out.println(perPerson);
```

}

}

Here’s another way to calculate total w/ tax (same result, of course):

`subtotal * ( 1 + tax )`