Summation of all the digits

Assignment Help Basic Computer Science
Reference no: EM131289192

First your program should ask if the credit card is MasterCard or visa card. Then ask the 16 digit credit card number. Then add all the digits in the credit card number and get the modulo 10. If the modulo 10 of the summation of all the digits is zero, then its valid visa card.

If the modulo 10 of the summation of all the digits is 1 then its valid MasterCard. Otherwise, the number customer has entered is an invalid card number. There are two other requirements that make this problem unique:

A) You need to read the card number as a single string and each 4 numbers in the card must be separated by a space. For example, following is a correct input 1234 5678 6789 1235

B) Card number must have 16 digits. If not, display the error message "incorrect card number"

My main issue has been parsing the integers from the long string. I'm using scan.nextLine() to capture the entire number with the spaces, but when I try to parse it, I get a NumberFormatException error.

Reference no: EM131289192

Questions Cloud

What if it is to be delivered at the end of six months : Assuming monthly compounding, what should the forward interest rate of a three-month T-bill be if it is to be delivered at the end of three months? What if it is to be delivered at the end of six months?
Write a java program to compute the value of e : There are many ways of calculating the value of e, but none of them ever give an exact answer, because eis irrational (not the ratio of two integers).
Evaluate policies and processes that promote a diverse work : Determine employment laws that apply to the selection, development, and management of employees.
What business interest would there be in your findings : What are your research questions? What type of tourists will be attracted to region X - what business interest would there be in your findings?  Tourism Authority, Airlines, Tourist Package Operators
Summation of all the digits : If the modulo 10 of the summation of all the digits is 1 then its valid MasterCard. Otherwise, the number customer has entered is an invalid card number. There are two other requirements that make this problem unique:
Explain the consequences for the spot market transaction : Explain the consequences for the spot market transaction and the forward market transaction if the $/£ spot exchange rate increases over the next six months.
Who pays and how much will the company pay : On the other hand, if LIBOR is less than 6 percent, Interfirst will pay KF. If LIBOR is 5.5 percent in six months, who pays and how much will the company pay? What if LIBOR is 6.5 percent?
Design a needs assessment plan : Design a needs assessment plan and identify three specific training initiatives you would recommend for these employees. Include the expected outcomes for the three training initiatives in your proposal.
Different erp software solution : Read the case study on pages 175 - 176. Answer the following question: 1. What advice would you give Shell if it decided to use a different ERP software solution?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe how to connect the spi0 pins for the hcs12

Describe how to connect the SPI0 pins for the HCS12 and this peripheral device and write an instruction sequence to configure the SPI subsystem properly for data transfer. Assume that the E-clock frequency is 24 MHz.

  Asynchronous transaction processing mode

When operating in an asynchronous transaction processing mode, what information must be present in both the pending request and the received response messages for the response to be exclusively matched to its associated pending request?

  Would you advise your friend to do this why or why not

Your friend must first submit some basic personal information, then complete a five-page personality survey, and finally provide several recent photos. Would you advise your friend to do this? Why or why not?

  Programming with control structures

Develop a Python program which will calculate the sum of an integer series, as described below. The program wil repeatedly prompt he user to enter a command (a character string). The program wil halt and display the mesage "Program halted normaly" wh..

  Would the system ever acknowledge this data

Suppose during an asynchronous parallel SCSI data transfer someone removes a floppy disk from the drive that is the intended target of the transfer.

  Draw a structured flowchart describing the steps

1. Draw a structured flowchart describing the steps you would take to cook popcorn in a microwave oven. Include at least one decision. 2. Create the pseudocode to go along with the flowchart created in question above.

  Create a system using dasylab which produces the fourier

Create a system using DASYLab which gives you the sum of the first n sinusoidal signals (n = 1,2,3,....9) as in Illustration 27

  Summarize the dba''s responsibilities for managing database

Briefly describe five difficult problems for organizations that create and use multiuser databases.

  Submit a java program comprising two source files

Submit a Java program comprising two source files: MyArrayList.java, defining a generic MyArrayList class representing "stretchy" arrays. This class is to mimic some features of the built-in ArrayList generic collection class .

  What is the probability p[b > 500,000] that a fax

What is the probability P[B > 500,000] that a fax has over 500,000 bits?

  What server type would you most likely need to deploy

What server type would you most likely need to deploy at each physical location in a WAN?

  Write a complete interactive menu-driven program

Write a complete interactive, menu-driven program using the binary file built previously and your primary and secondary indexes in memory.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd