The Student Room Group

I need help with a Visual Basic project for GCSE

Anyone know how to create a program that you enter your loyalty card number,expiry date, name and postcode. It has to check if the card has expired, if the loyalty card number is valid by:
Allowing the user to enter the 8 digits
Removing the 8th digit and storing it as Check_digit
Reversing the numbers
Multiplying the 1st 3rd 5th and 7th digits by 2
^If the result is greater than 9 then subtract 9 from the result
Add together the resulting 7 digits
Finally check if the sum of the added digits plus the check_digit is divisible by 10
Anyone able to help me
(edited 6 years ago)
How far have you managed to get with this? It would help if you could specific about which part of this you're stuck on, including the code you've tried to solve each problem, any errors, or detail about what isn't working. .

Is this a Console app or a GUI program? If it's a GUI program Have you attempted to create the visual layout in a Form using the appropriate controls? If it's a console program, do you know how to read input from the user and write out to the console?

Take each of the program's requirements one step at a time, and make sure you compile + run your program as often as possible after every tiny change to make sure you stay on top of any errors. Don't try to solve everything at once.

If a problem seems too complex, break it down into something smaller and just solve one part of that problem on its own, then move on to the next piece of that problem, and so on. For example, if the user types in 8 digits, do you know how to get the 8th digit of the user's input? Then do you know how to remove that digit or get the other 7 remaining digits?

If you get stuck with specific problems in Visual Basic, such as any compiler errors, or you need some simple examples such as how to get some data from a user, google for the thing you're trying to do, and you'll be very likely to find a lot of examples and tutorials online which match the problem you're having. You might also find a lot of useful answers to Visual Basic programming questions on https://www.stackoverflow.com/ from people who have gotten stuck in the same way as you before.
Reply 2
How would I put an expiry date on the card. So say i want the expiry date to be tomorrow 1/3/18 how would i do that and validate whether or not their card is valid or not?
TBH im a beginner at programming, but break it down:

- You need to validate to have numbers or special characters only
- It has to be equal to or greater than the date today
Reply 4
Also I have done calculations so how do i make sure all 7 numbers plus the 8th(stored in a variable) are divisible by 10?
Original post by TDevlin172
How would I put an expiry date on the card. So say i want the expiry date to be tomorrow 1/3/18 how would i do that and validate whether or not their card is valid or not?


You can help users choose a date on a UI using the DateTimePicker control:
https://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker(v=vs.110).aspx

DateTime.Today could help you in your validation: https://msdn.microsoft.com/en-us/library/system.datetime.today(v=vs.110).aspx

Original post by TDevlin172
Also I have done calculations so how do i make sure all 7 numbers plus the 8th(stored in a variable) are divisible by 10?


You can use the Mod operator to check whether two numbers are evenly divisible - https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/mod-operator

Quick Reply

Latest