In this practice lecture, your task would be to create two functions.
The first one should take a CHA, the energy efficiency category and print out the energy consumption
of each level by using a switch or if as a standard for very low, B is low, C normal.
The above normal is high, F is very high, and G is extremely high energy consumption.
I would suggest you to make the function compatible with lowercase and uppercase char arguments.
Also, I would like you to modify the function to return a string and print out the return string with
a system that Outbrain on the second function should print out a car description and it should have
three parameters string car model and production year and string condition.
It can be good, bad, used or damaged.
I also suggest you to post the video here and try to do this on your own and get back here after you've
finished and compare your code to mine.
If something is not clear for you or you think you have another solution, feel free to share that with
me, OK?
You can create a new class for this task.
I'm going to add the two functions to the functions and class we created in the last lecture.
All right.
Start with static void.
The function name gets energy of efficiency, Prentice's char category, curly braces, and I'm going
to use switchgear service, which it's going to take to category curly braces, case single quotes,
uppercase A..
And Callon, as I said, it, should able to take lowercase letters as well.
So case.
Simple coats, a hand column now stand out out of print on darbo coats, very low energy consumption
and break and a semicolon now copied these lines, copy paste it here and again.
And again and again.
Change A to B, then C,
D,
e.
Beth.
And lost G.
Change the text, so it's going to be low, C is normal.
These is normal.
He is high.
I have a very high.
And she is extremely high.
What is missing here is a default.
So default and system out of print alone, not defined category.
Now call the function in the main method, so.
Get energy efficiency and use a as an argument.
Now we're in a code.
And the proper taxes printed out now try with a lowercase G once again, and that's correct again now
change the function from Boyte to return a string and print out that string.
So scroll back here.
Change Voit to string.
And instead of system that I would to land use return and remove these parentheses, and we don't need
a break anymore because of return and the execution and the code after that won't be wrong.
So let's change that.
And the other crisis to so return.
Well, this.
The little break as well.
Return.
So now the latest to break.
Just a few times.
And here to.
OK, now scroll back, and instead of calling the function printout the return values, so this is standard
output, Frinton.
But let's change the argument to be now wrung out cold.
All right, so low energy consumption is printed out.
The good thing about modifying the function to return a string or any other value is that we can use
that to return that value for other purposes.
Now move on to our second function so that function should print out a short description of a car.
Starting with static.
Void Girths, car description Prentice's string model Colma and production year Colma string condition
curly braces system that outthought print on Tombo codes.
This.
This car is a.
Plus model.
Double this line changed a text.
Production here, Colin, used to worry about production year, double this line it is and change the
variable name to conversion, plus the quotes space cannulation.
Lay this out, there is a typo.
Now, call this matter at the end of the main method.
So.
Get a car description, the first parameters model, I will use Tesla Roadster,
comma, production year 2018, coma conditions and in good condition.
Now, on called again.
It seems everything works properly at the end, I suggest you to create your own version.
I hope this lecture was helpful seeing the next one.