Question

This project is to be performed individually or by a group of up to two students. You willl use C++ and /or Assembly programm

0 0
Add a comment Improve this question Transcribed image text
Answer #1

--------------------I used Visual Studio 2013, C++ Language, Console App------------

NOTE:

First thing you keep in mind, This question is hypothetical because in any bank ATM if 3 tries wrong then card is blocked.

So in this case what i did is, In each attempt from 0 to 9999 at every 50 wrong entries it is creating new PIN from next 50 to 9999;

For example : Hacker attempted 50 times, that is 0 to 50.

At 50 wrong attempts new PIN generate from 50+50 = 100 to 9999, So next hacker attack from 50 to 100 but the new PIN generate between 100 to 9999

At 100 wrong attempts new PIN generate from 100+50 = 150 to 9999,So next hacker attack from 100 to 150 but the new PIN generate between 150 to 9999

In this way we will be always ahead of the next 50 numbers he gonna enter, atlast he will enter 9950, At that time code will generate from 0 to 9999(Only in this case he might get success).

--------OUTPUT-------

8 Quick Launch (Ctrl+Q) DATMRandom Numbers (Running) - Microsoft Visual Studio (Administrator) FILE EDIT VIEW PROJECT BUILD D

-----CODE-------

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
#include <iostream>
using namespace std;

int GenerateRandomPIN(int);

int main()
{
   srand(time(0)); //Used to get random number at each time
   for (int k = 0; k < 10; k++) // Running 10 times
   {
       int userEnteredPIN = 0;
       bool PINgotit = false;
       //Hacker tries from 0 to 9999
       for (int attemptedPIN = 0; attemptedPIN < 10000; attemptedPIN++)
       {
           if (attemptedPIN % 50 == 0) //At each 50 generating new random number
           {
               //GenerateRandomPIN parameter is the attempt number
               userEnteredPIN = GenerateRandomPIN(attemptedPIN);
           }
           if (attemptedPIN == userEnteredPIN)//if matched, terminate this loop
           {
               PINgotit = true;
               break;
           }
       }
       cout << "Attempt " << k+1<<" :: ";
       if (PINgotit)
           cout << "Hacked!!!... Defense system is weak" << endl;
       else
           cout << "Defense system is strong" << endl;
   }
   system("pause");
   return 0;
}


int GenerateRandomPIN(int val)
{
   int pin;
   int fromValue = val + 50;
   int numCount = 10000 - fromValue;

   // If numCount=0, then get random num between 0 to 10000
   //That is the last try from the hacker
   if (numCount == 0)
       pin = rand() % 10000;
   else
       // numCount is the limit and fromValue is the starting point
       //For Ex: Let say numCount = 100 and fromValue = 50 ,
       //Then generated pin number between 50 to 150, that is numCount(100) will add with fromValue
       //So min range is 50 and max range is 150
       pin = rand() % numCount + fromValue;

   return pin;
}

Add a comment
Know the answer?
Add Answer to:
This project is to be performed individually or by a group of up to two students....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java application program that plays a number guessing game with the user. In the...

    Write a Java application program that plays a number guessing game with the user. In the starter code that you are given to help you begin the project, you will find the following lines of code: Random generator = args.length == 0 ? new Random() :                    new Random(Integer.parseInt(args[0])); int secret = generator.nextInt(100); You must keep these lines of code in your program. If you delete these lines, or if you change thse lines in any way, then your program...

  • WEEK 6: COURSE PROJECT The Week 6 portion of your Course Project is due this week....

    WEEK 6: COURSE PROJECT The Week 6 portion of your Course Project is due this week. Please refer to the Course Project Overview in the Introduction and Resources module for full details. Use this report (Links to an external site.)Links to an external site. to complete this portion of the project. Guess the number! You will add to the program you created last week. This week you will add quite a bit of code to your project. You will add...

  • c++ launguage please help The game Pico Fermi Bagel is a number guessing game. The computer...

    c++ launguage please help The game Pico Fermi Bagel is a number guessing game. The computer picks a secret number: the secret number must be 3 digits, none of the digits can be the same, and it cannot start with a zero. 104 is OK, but 091 and 212 are not. The user tries to guess the secret number - if none of the digits in the user's number are in the secret number, then the program replies with BAGEL...

  • C++ Hangman (game) In this project, you are required to implement a program that can play...

    C++ Hangman (game) In this project, you are required to implement a program that can play the hangman game with the user. The hangman game is described in https://en.wikipedia.org/wiki/Hangman_(game) . Your program should support the following functionality: - Randomly select a word from a dictionary -- this dictionary should be stored in an ASCII text file (the format is up to you). The program then provides the information about the number of letters in this word for the user to...

  • This is a basic Java Question referencing Chapter 5 methods. The goal is to make a...

    This is a basic Java Question referencing Chapter 5 methods. The goal is to make a quick program that has the computer guess a number, after which the user will input if they would like to play the easy, medium or hard level. After this point the user will be allowed to guess a certain amount of times, before the computer tells them they are correct, incorrect, and gives them the guessed number. The Question is as follows: Define a...

  • For this lab you will write a Java program that plays a simple Guess The Word...

    For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...

  • PYTHON The provided code in the ATM program is incomplete. Complete the run method of the...

    PYTHON The provided code in the ATM program is incomplete. Complete the run method of the ATM class. The program should display a message that the police will be called after a user has had three successive failures. The program should also shut down the bank when this happens. [comment]: <> (The ATM program allows a user an indefinite number of attempts to log in. Fix the program so that it displays a message that the police will be called...

  • in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and...

    in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...

  • Write a java netbeans program. Project Two, Super Bowl A text file named “SuperBowlWinners.txt” contains the...

    Write a java netbeans program. Project Two, Super Bowl A text file named “SuperBowlWinners.txt” contains the names of the teams that won the Super Bowl from 1967 through 2019. Write a program that repeatedly allows a user to enter a team name and then displays the number of times and the years in which that team won the Super Bowl. If the team entered by the user has never won the Super Bowl, report that to the user instead. For...

  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT