Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-09-2005, 09:39 PM   #1 (permalink)
djlove105fw
Registered User
 
Join Date: Feb 2005
Posts: 3
djlove105fw is on a distinguished road
help

This is my next Program and I would like some help to start coding it.
I am also new in programming.

A local bank has instituted a new credit system and would like to have account numbers that are self-checking in order to have some protection against fraud and clerical errors. They have devised a system a follows:

The account numbers will be nine digits long and the ninth digit(rightmost)can be calculated by either adding, subtracting, or multiplying all of the preceding digits and finfind the rightmost digit of the result. If the two righmost digits match, the account numbers is valid.

In the operation code(the first digit), 1 is addition, 2 is subtraction, and 3 is multiiplication. Any other digit in this position is incorrect.

Your job is to write a program that will check the validity of an account number that has been sent to the bank as part of its daily transaction.

INPUT: a nine-digit account number.
OUPUT: Echo print the input, followed by account status.
(Either VALID, INVALID, or OPERATION CODE ERROR)

EXAMPLE: 123456786
1+2+3+4+5+6+7+8=36

6 is the rightmost digit in both the account number and the
result of the operation. Therefore, the account number is
VALID.

EXAMPLE: 312131413
3*1*2*1*3*1*4*1=72

The righmost digit of the result of the operation is 2, but
the rightmost digit of the account number is 3. This account
number is INVALID.
djlove105fw is offline   Reply With Quote
Old 02-09-2005, 10:37 PM   #2 (permalink)
fp_unit
mike
 
Join Date: Jan 2005
Location: Ottawa, ON
Posts: 79
fp_unit is on a distinguished road
Have you written any code yet? Thought out how to design it?
fp_unit is offline   Reply With Quote
Old 02-09-2005, 11:58 PM   #3 (permalink)
djlove105fw
Registered User
 
Join Date: Feb 2005
Posts: 3
djlove105fw is on a distinguished road
yes
djlove105fw is offline   Reply With Quote
Old 02-10-2005, 12:37 AM   #4 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Djlove105fw, you gave the answer by yourself practically. Show some code and tell us where you are exactly stuck and why.
__________________
Valmont is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 05:52 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting