# 1.9 Small Tax Program Part 2

Video Activity
Join over 3 million cybersecurity professionals advancing their career
or

Time
4 hours 19 minutes
Difficulty
Beginner
CEU/CPE
4
Video Transcription
00:00
hi and welcome back to the course.
00:03
So in the last video we left off right here, where we stored the user's income in the Incan bearable,
00:10
and that, I believe, was step number four.
00:14
So now we're on step number five. So I'm just gonna go ahead and correct that I will be here.
00:19
So in step number five, willing to calculate the income after attacks, And in order to do that, we need to first calculate the tax. So
00:29
00:31
make the tax variable equal to income Time's amount of
00:37
attacks that you want to apply. So in my case, let's say it's 13%. So do 0.13
00:43
So this year will calculate the tax only on the income that the user injured.
00:50
Now in step five. Since it's has been to calculate the income after attacks, we need to store
00:57
our new income in our new and convertible. So am I. But there's a typo here, so I'm just gonna have that onto here.
01:03
All right, so in when you in convertible, I will add the income
01:11
and then
01:11
the tax,
01:14
so this will ensure we have our new income which will include our tax.
01:19
Now, in step six, we need to print our new income.
01:23
And instead of just printing our new income and to experiment with a few more things and to show you one more extra thing, I will print out the income before tax and the income after tax so that you can see the calculations were made properly.
01:38
So just go ahead and add a system dot out dot print line. And inside the print line, you could write something like income,
01:45
and then in two brackets, he could write
01:49
before tax
01:52
and then make sure you add on just income to this first principle because this is the income without the tax.
02:00
And then
02:01
in my second print statement, I will be
02:06
printing out the income after attacks. So just changed that after
02:10
and then
02:12
this needs to be changed to what?
02:15
Right? So if you guessed unichem, it should be changed to a new income. So I'm gonna go ahead and type in
02:22
new income.
02:24
Great. So hopefully after all this, our program should be working.
02:30
There is one step that I would like to add
02:32
onto here, which would be
02:36
after this point, which would be Step five, where we need to
02:40
calculate tax only
02:45
just to make things a bit more clear.
02:50
Great. So that's gonna change to six. And that's gonna change something. So in seven steps we need a simple tax program. So let's go ahead and run it and actually see it working,
03:00
so to run the program. If you remember, we go
03:04
to the class and then we can click a run. Or what we can do is click on S. R. C, which stands for all our source files, and then go over here to our program. In my case, it's called tax Program. Go ahead to yours and then click Run.
03:21
Once you click a run, it should be building the program,
03:27
and they will take a few seconds. Roughly
03:30
great. So going, your consul and you can see it's says, Please enter your taxable income, which is the print that we had here.
03:38
And let's say my taxable income is, um,
03:43
60
03:45
60,000. Exactly. Let's try an exact number
03:50
now here. After I clicked, Enter it said income before taxes. 60,000. Income after tax is 67,000
03:58
800.
04:00
All right, Now let's do the actual calculation. So if we did,
04:04
um,
04:05
calculator,
04:09
calculate, call you later.
04:12
So let's do 60,000
04:16
times
04:18
0.1 groups.
04:23
I'm 0.13
04:28
That would be 7800. So then we do 60,000
04:32
plus 7800
04:34
which would equal to 67,800 is at the same number.
04:39
Yep, that is the same number.
04:41
Let's run it for not an integer Let's run it for a float or a double.
04:46
So it's on the program again.
04:49
Let's see. My taxable income is
04:51
60,500
04:56
and 52.60 or something like that
05:00
and click click enter.
05:02
So I have mis entered the numbers, so it's running a gun.
05:05
So let's say we entered 60,000
05:11
500
05:13
and 20
05:15
point
05:15
50
05:18
so this would give us an income before tax as 60,520 0.50
05:26
and then this would be our income after taxes. Now you may notice that the numbers are the NF additional point or not rounded off. You can do that, but for now we'll stick with this.
05:38
All right, so great. So this was our tax program. It's pretty short, but it's a sweet little program to wrap up module one. So going back to our slides and marginal one we discussed
05:49
Introduction to Java is the first video setting up our quoting environment, creating our first of our program, which was our hello world programs you remember,
05:59
And then data types and variables,
06:00
basic arithmetic,
06:02
accepting user input and then, finally, the small tax program so that here wraps up module one. I hope you enjoy the content and the concept you learned and Marshall one. There's much more to come in the falling models, and I look forward to seeing you and Marshall, too. As always, if you have any questions,
06:20
a few flew to connect with me. Arlington and I would be more than happy to answer any of your questions.
06:26
Thank you for watching again, and I'll see you in Module two
Up Next