Name:_______________________ Object-Oriented Programming Project: Project 1 – Mini-Craps Estimated time to complete: 1-3 hours. Estimated lines of code: 55-70, including comment lines. Exercise...

Please see attached for requirements.


Name:_______________________ Object-Oriented Programming Project: Project 1 – Mini-Craps Estimated time to complete: 1-3 hours. Estimated lines of code: 55-70, including comment lines. Exercise Overview · Implement a Java program that is based on the simulated roll of 2 dice. · Evaluate the dice roll and have the program assign various nicknames for the roll that comes from the game of chance called Craps. · On the console, show the dice values and print below the values the nicknames that are associated with the dice roll. There can be more than one nickname for each roll. Functional Requirements (how the code will work from the user perspective) · System prompts the user (player) for their name. · System displays a welcome message to the user on the console, including the user’s name. · System displays the initial roll including values of the dice and the sum of the dice. · Below the line with the dice values and sum, display the nicknames of the dice rolls. · Sum of 2, 3, or 12. “Craps”. · 1, 1. “Snake Eyes”. · 6, 6. “Box Cars”. · Sum of 7 or 11. “Winner”. · Double 2, 3, 4, or 5. [sum] the Hard Way. E.g., 2, 2 would be “4 the Hard Way”. · If the dice values are not in the list above, no nickname or message should be printed. · End the game by printing the end-of-game message. Technical Requirements (how you must code it) The system should include the following Java components: · System consists of the following sections. · Declare variables. · Create objects for Scanner and Random classes (input and random). · Prompt and read-in user’s name using Scanner, and then print the welcome message. · Assign the dice roll values using the Random class. Calculate the sum of the roll. · Evaluate the roll using appropriate selection statements and print the nickname(s) as they are identified. · Print a message, thanking the user by name for playing. · Variables required: · String name · int die1 · int die2 · int sum · Selection type statements that can be used (you do not need to use all of them): · if · if-else · nested if/if-else · conditional operators && and || · Name your source code main class (.java file) as YourName_Section5u1_Project1.java · To read in the name (String var) from Scanner object input, use: name = input.next(); · Algorithm for generating the random die values should use the Random class. · Random random = new Random(); // Creates the Random class object random · die1 = random.nextInt(6) + 1; // Assigns random value 1-6 to die1 · die2 = random.nextInt(6) + 1; // Assigns random value 1-6 to die2 Example output (from the Eclipse console) Hints and suggestions. · Use the statement System.out.println(); with no arguments (empty parentheses) to create a blank line for spacing lines on your console output. · To test all the different cases (dice value combinations) hardcode literal values to die1 and die2. Leave these in your code to demonstrate your testing approach but comment out these statements before submitting. Submission. Submit 2 files in eLearning. · First, after writing/pasting responses above, save this doc on your computer and attach/upload it as your submission in elearning. When you save this document on your computer, save it with the file name as follows: [FirstName_LastName]_Project1.doc or .docx. This file must be a Word doc. Google docs will not upload correctly to eLearning. · Second, export your .java file to your computer and attache/upload it as a second file in eLearning. The TA will be executing this .java file as part of the grading. File name should follow the format: [FirstName_LastName]_Project1.java. To export a .java file to your computer: · In Eclipse, name the file (class) you are submitting [FirstName_LastName]_Project1. When you export it to a folder on your computer, it will be saved as a .java file type. · In Eclipse on the Package Explorer, click on the .java file you want to send. Then click on File > Export > General / File System > Folder and file name for the file you are sending. Browse for the folder you want to copy it to, such as: C:\Users\[your_name]\Documents\[folder for ITSS 3311]. Then click Finish. · From here you can upload and submit it in eLearning from your Documents file. Rubric · File names of submitted files (Word doc and .java file) follow formats listed above. 1 pt. · Name and section are listed in comments at the beginning of the main method. 1 pt. · System runs without errors and fulfills functional and technical requirements. 3 pts. · Comments clearly identify the sections of the program. 1 pt. · Code follows conventions for variable names, indention, etc. 1 pt. · Code organization follows the outline in the project specification above and is easy to follow. 3 pts. · Code has appropriate use of selection statements – need at least 2 of the selection-type statement options listed above. 5 pts. · Selection statements are efficient. No unnecessary or redundant tests. 5 pts. PAGE 2
Jun 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here