00:01
Hello student, here is a step by step guide on how to modify the invoice app .java program to meet all the requirements.
00:09
So modify code, number one case, number one situation, number one condition to modify the code so that the application ends only when the user enter n, no, r, n.
00:19
So if the user enter these, so the application ends.
00:23
So old code was if continue input is not equal to y and continue input is not equal to capital y then break.
00:33
So this is the old now i have written the new one code.
00:36
So if not continue input dot equals ignore case.
00:44
So here i have added equal ignore case.
00:46
So here y and then in this case break.
00:50
So i have added this new thing and the changes use the equal ignore case method.
01:00
So here the changes are i have used this method equals ignore case.
01:05
So to compare the user input to the string y without regard to the case.
01:10
So whether we enter the capital y or the small y, this y or this y.
01:17
So this means that the application and if the user enters any of the following.
01:22
So according to this, the application will end if the user will enter small n, capital n, no and capital n, no, both are capitals.
01:38
So in this case, the application will not work.
01:43
So the application will stop.
01:45
Number two, modify the code.
01:48
So it provides a discount of 25 % when the subtotal is greater than or equal to 500.
01:57
So old code was double discount subtotal into 0 .90 because of 90 % subtotal 90 % of subtotal.
02:10
So new code here, according to the new code, double discount i have taken here.
02:17
I am doing the comparison.
02:18
If subtotal is greater than or equal to 500, then discount will be subtotal into 0 .25 else discount will be subtotal into 0 .90.
02:31
So here i have added 25 % will be given if the subtotal is greater than 500.
02:38
So in the old code, it was only 90 % of discount 0 .90 % of discount.
02:45
But in the old case, in the old code, there are two type of a discount.
02:50
One is 0 .25 and second one is 0 .90.
02:55
So if a subtotal is greater than 500, then this type of discount is applicable.
03:03
Otherwise this.
03:05
So this change checks if the subtotal is greater than or equal to 500.
03:10
If it is the discount is set to 25 % otherwise the discount is set to 90%.
03:15
So this is the modified code here.
03:18
Number three, to modify the code so it displays the number of the invoices, the average invoice amount and the average discount amount when the user ends the program.
03:28
So old code and now new code.
03:31
Enter number of invoices, 0, double total subtotal 0, initialize double total discount 0.
03:38
And now new code because everything i have to encountered in the new code.
03:43
So system .out .println number of invoices...