Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP ME WITH THIS PROBLEM AS QUICK AS YOU CAN. That would really help me out greatly. THANK YOU! Part 1 (solved on last

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

PLEASE HELP ME WITH THIS PROBLEM AS QUICK AS YOU CAN. That would really help me out greatly. THANK YOU! Part 1 (solved on last slide, make sure to change the function name to include your last name) A Poem The game will display the following poem on the screen, where the blank must be substituted by the user name. Enter your name: My student Jayz standing proud, My student Jayz, standing proud, is a is a fine example for the crowd. fine example for the crowd. The function must: Receive the user name as a String argument Return the poem as a String Part 2 Fortune Teller The game will give users their fortune. The fortune should be a String chosen at random from an Array or ArrayList of Strings that you create manually. Have at least 5 fortune Strings in the array. Sample running's: The function must: Receive the user name as a String argument Return the fortune as a String Part 3 Lottery The game will allow the users to play a game of lottery called Pick-3 where they pick 3 numbers from 1 to 9. To win, they have to match the 3 winning numbers in the exact order drawn. The winning numbers should be generated as random numbers Sample running's WELCOME TO THE LOTTERY GAME Give me 3 numbers between 1 and 9: 4 7 1 The winning numbers are: 4 8 5 Sorry you don't win this time. WELCOME TO THE LOTTERY GAME Give me 3 numbers between 1 and 9: 4 71 The winning numbers are: 4 7 1 Congratulations. You are a winner! The function must: Receive 3 arguments: an argument for each of the user's numbers Return the result as a String (the winning numbers plus a message indicating whether the user won) A main function where: A menu is displayed to let the user choose a game Read user input for the chosen game The corresponding function in the library of games (Games class) is called for the chosen game, sending the user input as argument(s) The result of the chosen game is displayed class Main { public static void main(String[] args) { System.out.println("WELCOME"); System.out.println("1 - Poem"); System.out.println("2 - Fortune Teller"); System.out.println("3 - Lottery"); System.out.println("4 - MadLibs"); System.out.println(""); System.out.println("Choose a game: "); Scanner s = new Scanner(System.in); int choice = s.nextInt(); if (choice==1) { System.out.println("What is your name?"); String username = s.next(); System.out.println(Games. zavalaPoem(username)); } // continue your program here for the other games // ask for the corresponding input for the game and // call the corresponding function from the Games class. }} REQUIREMENT: YOU MUST PRECEDE EACH FUNCTION NAME WITH YOUR LAST NAME The methods receive arguments instead of asking for input and return values instead of printing. No System.out println anywhere in this class No reading input (Scanner next, nextInt, etc.) anywhere in this class No main function class Games { public static String zavalaPoem(String name) { return "My student " + name + ", standing proud, is a fine example for the crowd."; } //continue your class here, add one function per game }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions