00:01
We're going to be creating a chava program that will ask the user to enter their name in the amount that they're paid and it will calculate how much it will cost the total amount of the pay.
00:14
And we will also be printing that.
00:17
So to get started, we can start by setting our class name, which will make an employee.
00:26
Make sure that we're out of, outside of these brackets.
00:31
Here.
00:35
Next, we want to initialize our variables.
00:42
So if we think about it, we have to think of what do we exactly need.
00:48
We need a string for the name, the integer for the hours worked, as well as having the extra hours.
01:07
So now that we have this in mind, we actually want to go in the braces.
01:20
Okay, so that we have established what we need and you're going to initialize a string, the employee name, integer, and we'll call this hours worked.
01:40
And now we're going to go into our main function here and we are going to first make sure we've imported our scanner which you can just copy and paste here so that we can get user input and we want to then create a variable for our scanner but here i'm going to just name it now we want to create an object from our class, which to do this, we need to first get the name of the class, and then our variable name, and then we need to say a new employee.
02:43
So anytime we reference this variable, we will be able to connect our, uh, connect our employee.
02:55
Information to the variables up here.
02:59
So now we can create a message, so system that line, enter name, and semicolon, and then you can be a string called boy name for and then we want to do s c.
03:27
Next line.
03:33
Okay, so that looks good.
03:35
Now i want to copy and paste this message and change it.
03:41
So i'm going to say, i'll say user to enter amount of hours work and enter extra hours.
04:00
So we're going to use an integer and we're going to name it hours work.
04:07
I also want to make sure we don't have the same variable name, so i do the sc, which is our scanner, and then instead of next line is going to be, here.
04:22
We this and change it to...
04:32
There you go.
04:34
Alright, so now we have gotten our input from our user.
04:39
So now, for the fun part, we want to then connect our object that we create our class to these variables up here.
04:55
So to do this, we need to go back up here and do employee, our variable name, and dot the variables that we've created up here.
05:08
I set it equal to our variable here, the string.
05:17
And we can do this, can do this, copy and paste here.
05:24
Here, we're going to match it with hours worked, hours worked, an extra hours, and extra hours.
05:34
So now that we've created, we've connected our user input to the variables we've created here in our class.
05:48
Now, lastly, we want to calculate the amount of pay for extra hours, so we'll create an integer total.
05:58
And we'll do, oh, actually, we forgot to add something, we forgot to add pay rate.
06:08
So let's just copy and paste this.
06:14
Oops.
06:20
Inter amount of your pay...