Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

java programming

java programming

Question Description

During each round, players choose a move, which may be either Gödishus, Derflürg, Kullen, Koppang, or Songesand. The rules are:

  • Songesand beats Kullen, Gödishus
  • Kullen beats Derflürg, Koppang
  • Derflürg beats Songesand, Gödishus
  • Gödishus beats Koppang, Kullen
  • Koppang beats Songesand, Derflürg

Your program should behave as follows:

  • The rules should be printed to the screen
  • The user is asked if they’d like to play a round
    • if they choose ‘y’, a round is played
    • if they choose ‘n’, the program ends
  • Until the user has chosen to quit, another round is played.
  • In a round of play:
    • The user is asked to enter a move, which may be either Gödishus, Derflürg, Kullen, Koppang, or Songesand. The program should continue to prompt the user until a valid move is entered.
    • The computer makes a move at random. (Hint: remember how we generated random numbers in class.)
    • The program prints the computer’s move, the user’s move, and who is the winner of this round.
    • The user is asked if they’d like to continue.
  • When the user has decided to quit the game, the program prints the number of:
    • rounds played
    • times the user won
    • times the computer won

    using switch and here is some suggestion:

    /* use named constants */public static final int GODISHUS = 0;public static final int DERFLURG = 1;public static final int KULLEN = 2;public static final int KOPPANG = 3;public static final int SONGESAND = 4;/* write a method that is passed two moves and returns who wins */public static boolean userWon(int userMove, int computerMove) {  /* good */  if (userMove == GODISHUS && (computerMove == DERFLURG ||                               computerMove == WHATEVER))  /* not as good */  if (userMove == 1 && computerMove == 2 || computerMove ..        }/* returns computer's random move */public static int randMove() {...}.../* using the method */int computerMove = randMove();System.out.println("computer entered: " +                    intMoveToString(computerMove));/* in response to question about what would happen   if we really wanted the String representation of    a move */public static String intMoveToString(int m) {  if (m == GODISHUS) {     return "Godishus";  } else if (m == DERFLURG) {     ...  }  etc.}

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: School Assignment only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by School Assignment are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. School Assignment is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At School Assignment, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.