00:01
In this video, we're going to be creating a book program that'll calculate the price of books according to how many books were purchased as well as magazines.
00:15
So to get started, you want to create variables for prices.
00:21
Let's say we have a magazine and it's going to be equal to 324.
00:27
Let's say hardcover books equal to $5 and paper.
00:35
Is equal to, we'll say $2 .50.
00:45
Okay, so now we want to ask the user the number of paperbacks, hardbacks, and magazines.
01:00
So to do this, we want to create a variable, call it numm for the number of magazines, and we'll get input from the user, enter number of magazines, and we'll get input from the user, enter number of magazines.
01:21
We also want to convert this to an integer so that we can then multiply the price to here.
01:33
So we're going to copy and paste this again sometimes just to h .c for hardcover and pb for paperback.
01:47
So we'll change a message to hardcover and and paperback books.
02:03
Okay, so now you want to create a list for the to store their total.
02:10
And we also want to create a boolean, set it equal to the true, and we also create a while statement so that we can loop the amount of times.
02:25
Okay, so we have our number of magazines, so let's check to see if this number of of magnitude the same meets our condition.
02:36
So let's say if our name is created in zero and the magazine is less than or equal to 50.
02:49
We want to add, actually we'll add this to our sum total up append actually will create a variable so to total equals um.
03:11
M times our magazine variable and then we'll pin that value to there okay and then we'll also ask the user okay we'll pin that value and then okay, else if statement for our red cover book.
03:45
So the number of, oops, put this up here.
04:00
There we go.
04:02
So create an if statement and also check if this needs our condition.
04:08
So if it is greater than zero, greater than zero, and less than are equal to 20.
04:25
We want to take the total again, but this time we're going to take our num hc, our numb hardcover.
04:34
Oops, and multiply it by the hot cover price, hardcover.
04:47
And we also want to do the same for that.
04:50
Yeah, we also want to append the total to that.
04:55
Okay, and now we can come out of that.
05:06
And okay, that looks good.
05:07
So now we can basically do the same thing for this.
05:12
It's copy and paste, change the variables, paperback.
05:24
Oh, oops.
05:25
There you go.
05:27
All right.
05:28
Well, that looks good.
05:34
All right.
05:35
So now we want to check the seat if they have entered a value that is not between the values.
05:49
So if they enter, say, 55, we want to print a message, same invalid value.
06:02
And you want to do the same for this, whoops, and down here...