CS 161 Lab H - Shakespearean Insult Generator

Due Thurs Mar 28 at 11:59pm

Overview

If you've read any plays by William Shakespeare, you may have noticed the man's skill at writing creative insults. In this lab, you will harness that mastery. You will implement a Java program that generates random insults using Shakespearean language and vocabulary. Moreover, because nothing helps make text more insulting like fancy windows, you'll be giving your insult generator fancy pop-ups that allow you to really stick it to someone, without requiring them to look at the terminal.

Your program will welcome the user and then prompt them to open a text file that contains lists of Shakespearean words:

After reading and processing this file, your program will show a pop-up message that insults the user and then dares them to get insulted again: (Note that since the insult is random, the generated insult will likely be different).

If you user clicks "Yes", your program will show them another insult and again prompt them for more. Once the user clicks "No," your program will get in one more jibe, showing a final insult before exiting.

This lab will be completed in pairs. Be sure to review the pair programming guidelines. You also must work with a different partner than you have before!

Objectives

Necessary Files

You will need to download and extract the BlueJ project from the LabH.zip file. This project will supply you with the following classes:

The zip file also contains the list of insulting words, in a file called Shakespeare.txt. Each line in the text file contains multiple words (but not an exact number) separated by commas and spaces. There are first a set of lines listing adjectives, then a blank line, then a set of lines listing nouns. You will need to parse each piece of this file separately.

Details

In this lab, you will not need to write any new classes! However, you will need to modify the Insulter class in order to complete the program.

BEFORE YOU BEGIN: read over the provided code carefully. Make sure you understand the code that is already there, and you see what functionality needs to be added. Can you write in some pseudocode that will detail the functionality?

Submitting

Grading

This assignment will be graded on approximately the following criteria: