Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this homework assignment you are going to create a basic credit card validator. Write a program that asks the user to enter their full

For this homework assignment you are going to create a basic credit card validator. Write a program that asks the user to enter their full name, credit card number and a credit card charge amount. Here is an example of what the program should look like when it runs:

What is the credit card holder's full name? = Robert Bruce

What is the credit card number? = 4417123456789113

How much should be charged on the credit card? = 110.14

You have successfully processed the payment in the amount of $110.14 You will need to validate the credit card number that a user provides. To do this I have provided you with a method already that you can copy into your program.

Don't worry, you don't have to understand how this method works. You just need to figure out how to paste it into your code outside of the public static void main() method. copy this method into your program and use it to validate a credit card number:

image text in transcribed

You also need to validate the card holder's name. Your program should store the name "Robert Bruce" omewhere in a variable and then check any name that is provided against the name "Robert Bruce". So, if I rere to use your program and put my name in "Henner Mohr", your program should tell me that the name I rovided was not correct. inally, your program should store the maximum credit card amount as $1000.00 in a variable. Your rogram should detect if the amount to be charged on the card is greater than this $1000.00 and then otify the user that the charge is beyond the credit max of the card. Your program should accept any alues with decimal points such as 110.13,256.85,811.87 for amounts.

You can use the following valid credit card number to test your program: 4417123456789113

Remember to format the output correctly as seen in my output above for the amount provided for the credit card charge amount. Also your program should loop each time an invalid item was detected. If an invalid name, or invalid credit card number or a invalid amount is used, your program should ask again to enter those values. This means that you should collect the name, credit card charge and amount. Then check if all three of them are correct. If ANY one of them is not correct, you need to ask the user to enter all the values (name, credit card number, amount) again.

You need to keep asking for these values until they get them all correct. Below is an example of what your code should look like when the user gives input that isn't valid. In this screenshot, the user entered a credit card number that isn't real. What is the credit card holder's full name? Robert Bruce What is the credit card number? 1234123412341234 How much should be charged on the credit card? 100.59 You entered an invalid name or a credit card number or an amount. Please try again. What is the credit card holder's full name? Robert Bruce What is the credit card number? 4417123456789113 How much should be charged on the credit card? 100 You have successfully processed the payment in the amount of $100.00

image text in transcribedimage text in transcribedimage text in transcribed

For this homework assignment you are going to create a basic credit card validator. Write a program that asks the user to enter their full name, credit card number and a credit card charge amount. See section 5.4 in your book to learn how to use the Scanner in Java to input data. Here is an example of what the program should look like when it runs: Console Debug Shell Main (1) [Java Application] /Volumes/Eclipse/Eclipse.app/Contents/Eclipse/plugins/org.eclips What is the credit card holder's full name? Robert Bruce What is the credit card number? 4417123456789113 How much should be charged on the credit card? 110.14 You have successfully processed the payment in the amount of $110.14 You will need to validate the credit card number that a user provides. To do this I have provided you with a method already that you can copy into your program. Don't worry, you don't have to understand how this method works. You just need to figure out how to paste it into your code outside of the public static void main() method. opy this method into your program and use it to validate a credit card number: 'ou also need to validate the card holder's name. Your program should store the name "Robert Bruce" omewhere in a variable and then check any name that is provided against the name "Robert Bruce". So, if I rere to use your program and put my name in "Henner Mohr", your program should tell me that the name I rovided was not correct. inally, your program should store the maximum credit card amount as $1000.00 in a variable. Your rogram should detect if the amount to be charged on the card is greater than this $1000.00 and then otify the user that the charge is beyond the credit max of the card. Your program should accept any alues with decimal points such as 110.13,256.85,811.87 for amounts. You can use the following valid credit card number to test your program: 4417123456789113 Remember to format the output correctly as seen in my output above for the amount provided for the credit card charge amount. Also your program should loop each time an invalid item was detected. If an invalid name, or invalid credit card number or a invalid amount is used, your program should ask again to enter those values. This means that you should collect the name, credit card charge and amount. Then check if all three of them are correct. If ANY one of them is not correct, you need to ask the user to enter all the values (name, credit card number, amount) again. You need to keep asking for these values until they get them all correct. Below is an example of what your code should look like when the user gives input that isn't valid. In this screenshot, the user entered a credit card number that isn't real. What is the credit card holder's full name? Robert Bruce What is the credit card number? 1234123412341234 How much should be charged on the credit card? 100.59 You entered an invalid name or a credit card number or an amount. Please try again. What is the credit card holder's full name? Robert Bruce What is the credit card number? 4417123456789113 How much should be charged on the credit card? 100 You have successfully processed the payment in the amount of $100.00

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

More Books

Students also viewed these Databases questions