Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write in java . I started it can you finish it. I will rate if code works What is this lab about and what will
Write in java . I started it can you finish it. I will rate if code works
What is this lab about and what will you be working on? In this lab, you will practice new tools and concepts you've learned in class and in lab. Namely this lab will be on methods, arrays (1D and 2D), and on repetition (using loops) In this lab, you will have to complete two activities. Here is what you have to do: Activity 1. [60 points] Method Lubn, You will have to implement the Luhn Checksum Validation algorithm to check whether a credit card number is valid or fake. This is a widely used algorithm that checks that you enter a valid credit card number when you are trying to make a purchase. Short description of the algorithm [Think Like a Programmer an Introduction to Creative Problem Solving by V. A. Spraull: Using the original number, double the value of every other digit, starting with the leftmost one, as shown below. Then add the values of the individual digits together (if a doubled value now has two digits, add the digits together - see below). The identification number is valid if the sum is divisible by 10 i.e., the sum has to be a multiple of 10 Example of execution of the algorithm Suppose you want to check that your credit card number is valid. You credit card number is 8273 1232 7351 0569. Let's see how to check it: 9 First, you are going to double every other number, starting with the first number (here, it is number 8) And you obtain 9 But we do not want double digits, so for every number that now has double digits, we add these digits And we obtain: 9 w we add all of these numbers: 7 2 5322 6+ 2 5 3 +1 +1053 +9 - 56 56 is not a multiple of 10, so the credit card number was a fakeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started