Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pls help. Pls use maximum till Nested loops and a little more if needed. Pls add comments so I can understand. Thank you so much

Pls help. Pls use maximum till Nested loops and a little more if needed. Pls add comments so I can understand. Thank you so much image text in transcribedimage text in transcribedimage text in transcribed

NOTE: You do NOT need to use arrays to solve this problem - this problem can be solved just with nested loops. Solutions that use an array where it isn't needed will be penalized in two ways: First, you're making the problem much harder than it needs to be, and second there will be a point deduction for use of an unnecessary array in the solution. Note: You will need to convert characters in your string into integer values in order to compute the sum. There are two ways to do this. The first is to use Integer.parseInt ( ) and substring() to get a character value. The following lines of code would give you the integer value of the first character of the string input: String s= input. substring (0,1); int val = Integer parseint (s); Another way to get a numeric value from a character is to use the method Character. getNumericValue (). This takes a char value (not a String) and converts it to its correct integer value. The following lines of code would give the integer value of the first character of the String input: char c= input charAt (0); int val= Character getNumericValue (c); Sample Output: This is a sample transcript of what your program should do. Items in bold are user input and should not be put on the screen by your program. Enter a credit card number (enter a blank line to quit): 5457623898234112 DEBUG: Sum is 68 Check digit is: 2 Enter a credit card number (enter a blank line to quit): 5457623898234113 DEBUG: Sum is 68 Check digit is: 3 Sample Output: This is a sample transcript of what your program should do. Items in bold are user input and should not be put on the screen by your program. Enter a credit card number (enter a blank line to quit): 5457623898234112 DEBUG: Sum is 68 Check digit is: 2 Enter a credit card number (enter a blank line to quit): 5457623898234113 DEBUG: Sum is 68 Check digit is: 3 Enter a credit card number (enter a blank line to quit): 5555555555554 ERROR! Number MUST have exactly 16 digits. Enter a credit card number (enter a blank line to quit): 55555555555544456789 ERROR! Number MUST have exactly 16 digits. Enter a credit card number (enter a blank line to quit): 5555555555554445 DEBUG: Sum is 72 Check digit is: 5 Enter a credit card number (enter a blank line to quit): Goodbye! 1234567891011121314/**DESCRIPTIONOFPROGRAMHERE@authorYOURNAMEHEREQuersionDATEHERE/importjava.util.Scanner;publicclassLuhnAlgorithm{publicstaticvoidmain(String[]args){I/TODO:Enteryourcodeherebetweenthecurlybraces?P Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago