I have been teaching myself programming for a few months now and have dabbled with Python and JavaScript, but I’m completely new to Java. I am working on a project that functions as an invoice calculator and I’m having some trouble with it. I have most of the program written but I know I am still missing a lot of it.
Here’s a list of what the program needs to include:
- Enter item number (alphanumeric).
- Enter item description (alphanumeric).
- Enter the item price (decimal).
- Enter quantity ordered (integer).
- Enter the total tax for the item (decimal).
- Enter the dollar amount, not a percent.
- Enter the total discount for the item (decimal).
- Enter the dollar amount, not a percent. Enter the net amount for the item (decimal).
- Display the item number, item description, item price, quantity ordered, tax amount, discount amount, and net amount. Use correct formatting for the data entered. Include appropriate labels. Labels should be on one line and data on the second line. Use tabs to line up the columns.
Here is the code I have so far (I’m aware there’s a lot missing and it’s messy):
Java code first photo:
Java code second photo:
Java code third photo:
I’m not sure where to start with the calculations for total tax, total discount, and net amounts.
I have tried to do research and look through my notes to find the syntax for calculations of the total tax, total discount, and net amounts and have been unsuccessful. No matter what I have tried, I can not get the program to work properly.
Callie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3