I\'m stuck on my final two lines of code here, and I\'m not sure why my numbers
ID: 3761821 • Letter: I
Question
I'm stuck on my final two lines of code here, and I'm not sure why my numbers don't figure correctly.
1. Total Tax (rounded) (sales times taxRate)
Type cast to int * 100, then double / 100.
2. Total Sale (not rounded) (sales plus tax)
This is what my output looks like at this point...
System.out.println("Total Units Sold " + ' ' +' '+ ' '+(s1+s2+s3+s4+s5));
System.out.println("Total Sales" + ' ' + ' ' + ' '+ ' '+ "$" + (sC1+sC2+sC3+sC4+sC5));
System.out.println("Total Tax" + ' ' + ' ' + ' ' + ' '+ "$" + (int)(sC1+sC2+sC3+sC4+sC5)* TAX_RATE);
System.out.println("Total Amount of Sales Including Tax" + ' ' + "$" + (sC1+sC2+sC3+sC4+sC5)+(sC1+sC2+sC3+sC4+sC5)*TAX_RATE);
Explanation / Answer
Answer :
small correction please check below lines
System.out.println("Total Units Sold " + ' ' +' '+ ' '+(s1+s2+s3+s4+s5));
System.out.println("Total Sales" + ' ' + ' ' + ' '+ ' '+ "$" + (sC1+sC2+sC3+sC4+sC5));
System.out.println("Total Tax" + ' ' + ' ' + ' ' + ' '+ "$" + (int)((sC1+sC2+sC3+sC4+sC5)* (TAX_RATE)));
System.out.println("Total Amount of Sales Including Tax" + ' ' + "$" +(sC1+sC2+sC3+sC4+sC5)+(int)((sC1+sC2+sC3+sC4+sC5)*(TAX_RATE)));
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.