Java

profilePmnguyen1989

  

Program 0 (Warm up): Gimme a cookie! In the early days of computing, you likely couldn’t afford your own computer. Instead, you had to sit at a terminal – which was literally just a monochrome monitor and keyboard that was connected to a big mainframe machine (hidden somewhere in the building). When you needed a break, you were supposed to log out. Not everyone did and later fell victim to the old “Gimme a cookie” prank. While the person was away, someone else would come along and write a quick program that said “Gimme a cookie: ". When the person returned, they saw this on their terminal. After repeatedly typing in random things (like passwords), they would eventually realize they needed to type the word “cookie” to regain control of their terminal. It’s quite funny, or at least it was 30 years ago. Design (pseudocode) and implement (source code) for this simple program.


Sample run 1:

Gimme a cookie: What?

Gimme a cookie: I don't understand

Gimme a cookie: Who is this?

Gimme a cookie: help?

Gimme a cookie: ls -l

Gimme a cookie: ^C

Gimme a cookie: ^D

Gimme a cookie: ESC

Gimme a cookie: cookie

Don’t leave your terminal open, fool!

    • 7 years ago
    • 10
    Answer(1)

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      java-gimme-cookie.zip