From the course: Practical Test-Driven Development for Java Programmers
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Using TDD to safely fix bugs
From the course: Practical Test-Driven Development for Java Programmers
Using TDD to safely fix bugs
- [Instructor] Well, we need to know how to deal with the letter X. Now I'll leave you to go and read the Wikipedia page if you wish to. But what you'll find is that when we do this calculation here, we're taking each value and multiplying it by a number. If it's the letter X, then it should have the value of 10. So when we do this line here, we need to check if it's an X and if it is, add the number 10. Now actually, what we can do is incorporate this within the if statement. So what we'll do is say, if this is a nine and it's the letter X, then we want to add 10 to our total. I should maybe point out that you don't need to multiply it by anything because the last number is always multiplied by one. Actually let's just work through this calculation to make sure that we understand it. I've got on screen here the ISBN number that we're trying to check. And we're going to multiply each of the digits by these numbers here. And if you remember, I said that the last digit counted for 10…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Testing for exceptions5m 17s
-
(Locked)
Challenge 129s
-
(Locked)
Walkthrough 11m
-
(Locked)
Challenge 22m 25s
-
(Locked)
Walkthrough 2 and challenge 31m 25s
-
(Locked)
Walkthrough 31m 51s
-
(Locked)
Getting to more complex requirements4m 57s
-
(Locked)
Using TDD to safely fix bugs6m 52s
-
(Locked)
Challenge 4 and walkthrough 44m 5s
-
(Locked)
Finishing the business requirements7m 24s
-
-
-
-
-
-
-