Program should read in a file called “sales.txt”. The contents of the text file are below. Create the sales.txt file with the following data: 10 100.00 9 18.18 100 50.00 64 121.22 560 1020.00 Read in all data from the file. (refer to pages 102-103) Sore units in integers and store sales in doubles. The first integer is the first unit sales. The first double is the first $ of all the sales combined. This continues through all five units. Utilize a constant called taxRate to hold the tax rate of 8.5%. Output the following items per the sample below: Total Unit Sales (the sum of all units) Total Sales (the sum of all sales) Total Tax (rounded) (sales times taxRate) Type cast to int * 100, then double / 100. Total Sale (not rounded) (sales plus tax) Output results in table format using the escape character for a tab as shown in the sample. Round the sales tax using basic math to round it. Do NOT use printf or any rounding function to perform this. Here is a few hints that I got. So the tax rate is a double as you know. What you need to do is convert it to an integer first by multiplying by 100 and storing as integer. Then convert it back to a double and store it as a double. What this does is round it by getting rid of anything that is going to be over 2 decimal places. This is what I have so far. I just need the Total Tax and Total Sales . This is what I have so far. import java.util.Scanner; import java.io.File; public class SalesTax { public static void main (String[] args) throws Exception { //Scanner stdIn = new Scanner(System.in); Scanner stdIn = new Scanner (new File (“sales.txt”)); int fUnit = stdIn.nextInt(); // First number of units double fPrice = stdIn.nextDouble(); // First Unit Price int sUnit = stdIn.nextInt(); // Second number of units double sPrice = stdIn.nextDouble(); // Second Unit Price int tUnit = stdIn.nextInt(); // Third number of units double tPrice = stdIn.nextDouble(); // Third Unit Price int foUnit = stdIn.nextInt(); // Fourth number of units double foPrice .nextDouble(); // Fourth Unit Price int fiUnit = stdIn.nextInt(); // Fifth number of units double fiPrice .nextDouble(); // Firth Unit price double taxRate= 0.085; double TotalSales = (fPrice + sPrice+ tPrice + foPrice + fiPrice); double TotalTaxes = (TotalSales * taxRate); double GrandTotal = (TotalSales + TotalTaxes); System.out.println(“TotalUnits = t” + (fUnit + sUnit + tUnit + foUnit + fiUnit)); System.out.println(“TotalSales = t$” + (fPrice + sPrice+ tPrice + foPrice + fiPrice)); System.out.println(“TotalTaxes =t$” + (TotalSales * taxRate)); System.out.println (“GrandTotal=t$” + (TotalSales + TotalTaxes));// end main// SalesTax
Posted on by admin
Program should read in a file called “sales.txt”
WHAT OUR CURRENT CUSTOMERS SAY
- Google Rating
- Sitejabber
- Trustpilot

Cindy L
You can't fault the paper quality and speed of delivery. I have been using these guys for the past 3 years and I not even once have they ever failed me. They deliver properly researched papers way ahead of time. Each time I think I have had the best their professional writers surprise me with even better quality work. Elite Academic Research is a true Gem among essay writing companies.

Samuel Y
I really appreciate the work all your amazing writers do to ensure that my papers are always delivered on time and always of the highest quality. I was at a crossroads last semester and I almost dropped out of school because of the many issues that were bombarding but I am glad a friend referred me to you guys. You came up big for me and continue to do so. I just wish I knew about your services earlier.

Mindi D
Brilliant writers and awesome support team. You can tell by the depth of research and the quality of work delivered that the writers care deeply about delivering that perfect grade.

Stuart L
Thanks for keeping me sane for getting everything out of the way, I’ve been stuck working more than full time and balancing the rest but I’m glad you’ve been ensuring my school work is taken care of. I'll recommend Elite Academic Research to anyone who seeks quality academic help, thank you so much!

Zahraa S
Absolutely spot on. I have had the best experience with Elite Academic Research and all my work have scored highly. Thank you for your professionalism and using expert writers with vast and outstanding knowledge in their fields. I highly recommend any day and time.