1st Jan 2019, 2:56 PM
Harsh Agrawal
Harsh Agrawal - avatar
4 Antworten
+ 16
● item[i]= sc.next(); //try this change
1st Jan 2019, 3:40 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
Harsh Agrawal First of all don't create so many inputs because it will be complicated for the user to enter like that... It is shows input mismatch exception when the user has not written the input in the required way..
1st Jan 2019, 3:29 PM
Coding Niffler
Coding Niffler - avatar
+ 4
Your code looks no problem to me. input at separate lines for code playground By the way, why keep doing this: namt+= tamt+0.08*tamt; at line 40? It makes the namt a sum of geometric sequence of total amount. Doesn't looks logical. I think you want to do this once only outside the for loop, and if it's a discount you don't += and +tamt, just namt = 0.08*tamt
1st Jan 2019, 3:08 PM
Gordon
Gordon - avatar
1st Jan 2019, 4:07 PM
Harsh Agrawal
Harsh Agrawal - avatar