How to write jasmine test case for angularjs?

Array e of ints contains the digits of a number without its check digit. Write code to calculate the check dig?

  • Array e of ints contains the digits of a number without its check digit. Write code to calculate the check digit for this number and store it in checkdigit. The check digit should be such that, if it were inserted after the last digit of e, the result would be the digit array of a number that is valid according to the Luhn algorithm. // Enter values to test here int[] e = { 8,7,6,2 }; int checkdigit; int sum = 0; int dd; for ( int i = 0; i < e.length; i++ ) { /* Your code here */ } checkdigit = /* Your code here */ ; Test case #1 Expected result: checkdigit is 7 // Enter values to test here int[] e = { 5 }; int checkdigit; same code Test case #2 Expected result: checkdigit is 9 // Enter values to test here int[] e = {8,7,6,3}; int checkdigit; same code Test case #3 Expected result: checkdigit is 5 // Enter values to test here int[] e = {3,7,7,2}; int checkdigit; same code Test case #4 Expected result: checkdigit is 1 Thanks!:D

  • Answer:

    People here generally prefer to help students who did make an effort to do their homework, rather than just posting the homework here without trying. If you noticed, those who posted their code or asked specific questions are more likely to get a good answer. If you do not even know how to start maybe you should go over your text book and class notes. Then try it on your own. If you cannot get your code to work, post your code here, or ask specific questions such as exactly where you get stuck or what you do not understand. Then someone will be happy to help you. Good luck.

ChrisHug... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.