Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:55:49+00:00 2026-05-11T10:55:49+00:00

I am writing a quote-matching program in which two Abstract Factory Patterns are required,

  • 0

I am writing a quote-matching program in which two Abstract Factory Patterns are required, these are two interfaces; QuoteFactory and ModeFactory. ModeFactory switches between EasyMode and HardMode and QuoteFactory picks out Quotes between several different subjects (i.e. PoliticalQuotes, SportsQuotes). In short, the user will pick a mode, if the EasyMode is picked then the user has to guess the quote whereas if the user chooses the HardMode the user is told who said the quote and then has to guess, so the implementation of the Quotes will change depending on the Mode as well as the Quotes chosen.

So far I have created ModeFactory as an interface and implemented it into EasyMode and HardMode, but now I need to somehow integrate another Abstract Factory Pattern (or more) into these modes so that the Quotes can be chosen. If it is helpful I have also created a Quote class in which my Quotes are defined.

Can anyone help me come up with a basic implementation of these Abstract Factories? This is the outline of what I have so far, although I cannot help but feel that I have overcomplicated it somehow…

EDIT: To reclarify what I mean: If the user picks the Easy Mode then they are provided with the start of a quote AND the author of that quote, whereas if they pick the Hard Mode they are only provided with the start of the quote. For example

Easy Mode: ‘I felt the power of…’ Jose Mourinho

Hard Mode: ‘I felt the power of…’

The hard mode does not give the author to make it harder for the user to guess the rest of the quote. Also, this is not a school assignment. I’ve been reading Head First Design Patterns and now I’m trying to apply what I’ve learned into different situations (instead of their Pizza example I’m working on a Quote Guessing Game, after reading through the QI (British TV Show) book.

public interface ModeFactory {     public Mode retrieveMode(String s);  }  public interface QuoteFactory {     public Quote retrieveQuote(String s); } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:55:50+00:00Added an answer on May 11, 2026 at 10:55 am

    Without too much thinking, and trying to keep to your design, how about something like this (I assume that the Quote class has getText() and getAuthor methods, also you might want to make it getText(int numberOfWords) so you can configure how much of a quote to give):

    public enum Mode  {     EASY,     HARD, }  public enum Category  {     SPORTS,     POLITICS, }  public abstract class QuoteFactory  {     public QuoteFactory getQuoteFactory(final Mode mode)     {         // return either the Hard or Easy QuoteFactory     }      public abstract Quoute getQuote(Category category) }  class HardQuoteFactory     extends QuoteFactory {     public Quote getQuote(final Category category)       {          // ...     } }  class EasyQuoteFactory     extends QuoteFactory {     public Quote getQuote(final Category category)       {          // ...     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 130k
  • Answers 130k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I was able to put together a solution that didn't… May 12, 2026 at 6:04 am
  • Editorial Team
    Editorial Team added an answer Here's a project you might be interested in: Console May 12, 2026 at 6:04 am
  • Editorial Team
    Editorial Team added an answer Given: uint n = 3; int i = checked((int)n); //throws… May 12, 2026 at 6:04 am

Related Questions

I have some code like this in a winforms app I was writing to
I am writing a Python utility that needs to parse a large, regularly-updated CSV
I am writing something that will allow users to search through a log of
I have seen many references stating that TableAdapters are weak and silly, and that

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.