Question

Please do in Java source Insulted yet? Most people get harassed by telemarketers, so for your...

Please do in Java source

Insulted yet? Most people get harassed by telemarketers, so for your warmup question, you’re going to design (pseudocode) and write (source code) a program that generates (clean) insults at random. The program must have a function that takes in the name of a person and prints out an insult directed to them. Further, the program should ask if the person has had enough insults and continue until they type “yes”. Your code must have at least five different kinds of insults. Any profanity receives an automatic grade of 0. If you don’t recognize these insults, shame on you! See Appendix for language-specific help.

Sample run 1: Enter your name: King Arthur

King Arthur, your mother was a hamster!

Shall I taunt you another time [yes/no]? yes

King Arthur, you English pig dog!

Shall I taunt you another time [yes/no]? yes

King Arthur, you don't frighten me!

Shall I taunt you another time [yes/no]?

yes King Arthur, you don't frighten me!

Shall I taunt you another time [yes/no]? yes

King Arthur, you English pig dog!

Shall I taunt you another time [yes/no]? no

Now go away, you silly English Knnnnniggets!

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

import java.util.Scanner;

public class Insulted {
  
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
  
String insults[] = new String[]{"your mother was a hamster",
"you English pig dog",
"you don't frighten me",
"don't you underestimate me",
"lovely pig dog you are"};
  
System.out.print("Enter your name: ");
String name = sc.nextLine().trim();
  
String choice;
  
do
{
int picker = (int)(Math.random() * 4) + 0;
System.out.println(name + ", " + insults[picker] + "!");
  
System.out.print("Shall I taunt you another time [yes/no]? ");
choice = sc.nextLine().trim();
if(choice.equalsIgnoreCase("no"))
{
System.out.println("Now go away, you silly English Knnnnniggets!");
System.exit(0);
}
}while(!choice.equalsIgnoreCase("no"));
}
}

****************************************************************** SCREENSHOT *********************************************************

run: Enter your name: King Arthur King Arthur, dont you underestimate me! Shall I taunt you another time (yes/no]? yes King

Add a comment
Know the answer?
Add Answer to:
Please do in Java source Insulted yet? Most people get harassed by telemarketers, so for your...
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 pseudocode and the write the source code in C++, thanks! Program 0: Insulted yet? Most...

    Write pseudocode and the write the source code in C++, thanks! Program 0: Insulted yet? Most people get harassed by telemarketers, so for your warmup question, you're going to design (pseudocode) and write (source code) a program that generates (clean) insults at random. The program must have a function that takes in the name of a person and prints out an insult directed to them. Further, the program should ask if the person has had enough insults and continue until...

  • You do NOT have to submit your personal questionnaire. But I do want you to answer...

    You do NOT have to submit your personal questionnaire. But I do want you to answer this; Does taking this questionnaire change your thinking in any way regarding the behaviors of the children in your classroom? This Questionnaire will be asking you some questions about events that happened during your childhood; specifically the first 18 years of your life. The information you provide by answering these questions will allow us to better understand problems that may have occurred early in...

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