Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:05,410
Onwards, the part three in part to out the code for Case A. And here's what we have so far.
2
00:00:05,970 --> 00:00:11,430
The user chooses to buy a car and then we check if they can afford it, if they have insurance, have
3
00:00:11,430 --> 00:00:13,530
a license and a good credit score.
4
00:00:15,130 --> 00:00:17,620
And if everything checks that, we let them buy a car.
5
00:00:20,330 --> 00:00:23,750
In this lesson, we're going to add the logic for Case B, selling a car.
6
00:00:25,200 --> 00:00:30,390
Into the job, a dealership will purchase anyone's car under two conditions, the selling price is lower
7
00:00:30,390 --> 00:00:35,130
than the car's value and the selling price is lower than 30000 dollars.
8
00:00:37,680 --> 00:00:42,270
So the first thing I'm going to do is delete this print statement and then the program is going to ask
9
00:00:42,270 --> 00:00:44,060
the client for the value of their car.
10
00:00:44,460 --> 00:00:45,360
So print.
11
00:00:47,970 --> 00:00:50,460
What is your car valued at?
12
00:00:53,040 --> 00:00:58,500
And because sense aren't relevant in buying or selling cars, you're going to store the value as a whole
13
00:00:58,500 --> 00:01:01,980
number int value is equal to Scannon extends.
14
00:01:09,910 --> 00:01:14,770
Now we're going to ask the user how much they're selling the car for, what is your selling price?
15
00:01:19,720 --> 00:01:22,210
And we're going to store the selling price as a whole, no.
16
00:01:23,950 --> 00:01:25,600
Scandal next it.
17
00:01:28,340 --> 00:01:33,710
Now the dealership will buy the car under one condition, the price has to be lower than the car's value
18
00:01:34,100 --> 00:01:36,050
and lower than 30000.
19
00:01:36,740 --> 00:01:39,120
I hope this made you think of the end operator.
20
00:01:39,770 --> 00:01:45,680
So if the value of the car is greater than the price it's being sold at.
21
00:01:48,380 --> 00:01:51,080
And if the price is less than 30000.
22
00:01:56,100 --> 00:01:59,580
Then the dealership will buy the car, that is, we're going to print.
23
00:02:02,230 --> 00:02:03,450
We will buy your car.
24
00:02:05,470 --> 00:02:07,360
A pleasure doing business with you.
25
00:02:14,860 --> 00:02:15,820
Otherwise.
26
00:02:20,570 --> 00:02:22,550
Sorry, we're not interested.
27
00:02:28,450 --> 00:02:30,490
OK, I think we're ready to run our code.
28
00:02:34,740 --> 00:02:36,300
We're going to select option B.
29
00:02:37,350 --> 00:02:41,290
What is your car valued at, let's say 25000 selling price.
30
00:02:41,310 --> 00:02:46,080
Let's sell it at 20 thousand and the dealership buys my car and that's all.
31
00:02:46,110 --> 00:02:47,280
Now you have an outlet.
32
00:02:47,280 --> 00:02:50,200
You buy or sell a car for selling a car.
33
00:02:50,220 --> 00:02:52,530
You started by picking up two integer values.
34
00:02:55,500 --> 00:03:01,410
And the values that you enter to make both comparisons, true, so Java and the code inside the statement
35
00:03:01,410 --> 00:03:03,000
and the dealership bought your car.
36
00:03:04,610 --> 00:03:08,120
In any case, we should add some blank lines to make the output look better.
37
00:03:10,510 --> 00:03:15,850
So starting from what is your car valued at, at a blank line at the beginning of each print line statement?
38
00:03:18,440 --> 00:03:19,460
So again.
39
00:03:22,160 --> 00:03:23,210
Slash and.
40
00:03:27,010 --> 00:03:27,820
And another.
41
00:03:35,220 --> 00:03:36,420
We're in a rerun the code.
42
00:03:41,710 --> 00:03:43,300
And we're going to choose option B.
43
00:03:45,290 --> 00:03:48,620
Twenty four thousand selling price of, say, 20000.
44
00:03:51,230 --> 00:03:53,180
And the output looks really good.
45
00:03:53,900 --> 00:03:57,020
There you have it, you built an interactive dealership application.
46
00:03:59,850 --> 00:04:03,900
In this lesson, you added the logic for selling a car if you made it this far.
47
00:04:03,930 --> 00:04:05,170
I want to congratulate you.
48
00:04:05,580 --> 00:04:09,330
Now, you have full control over how your code runs using.
49
00:04:09,750 --> 00:04:15,600
You let the user choose from a list of options and using a false you controlled how the dealership reacted
50
00:04:15,600 --> 00:04:16,990
based on the user input.
51
00:04:17,640 --> 00:04:19,670
I think it's time for your big challenge.
4644
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.