Microsoft Word - CCCS_300_A2_FALL.docxASSIGNMENT 3 CCCS 300 Due: See Mycourse Please read the entire PDF before starting. You must do this assignment individually. It is very important...

1 answer below »
Please make sure not to give this assignment to the same agent who did my A2 as multiple steps were not followed. I shared my results with you as a learning curve. Since I was short on time I was not able to complete the correction and I had 85% mark. I need 100% to pass the class.


Microsoft Word - CCCS_300_A2_FALL.docx ASSIGNMENT 3 CCCS 300 Due: See Mycourse Please read the entire PDF before starting. You must do this assignment individually. It is very important that you follow the directions as closely as possible. The directions, while perhaps tedious, are designed to make it as easy as possible for the TAs to mark the assignments by letting them run your assignment, in some cases through automated tests. While these tests will never be used to determine your entire grade, they speed up the process significantly, which allows the TAs to provide better feedback and not waste time on administrative details. Up to 30% can be removed for bad indentation of your code as well as omitting comments, or poor coding structure. To get full marks, you must: • Follow all directions below – In particular, make sure that all classes and method names are spelled and capitalized exactly as described in this document. Otherwise, you will receive a 50% penalty. • Make sure that your code compiles – Non-compiling code will receive a 0. • Write your name and student ID as a comment in all .java files you hand in • Indent your code properly • Name your variables appropriately – The purpose of each variable should be obvious from the name • Comment your work – A comment every line is not needed, but there should be enough comments to fully understand your program Page 2 1 Part 1 (0 points): Warm-up Do NOT submit this part, as it will not be graded. However, doing these exercises might help you to do the second part of the assignment, which will be graded. If you have difficulties with the questions of Part 1, then we suggest that you consult the TAs during their office hours; they can help you and work with you through the warm-up questions. You are responsible for knowing all of the material in these questions. Warm-up Question 1 (0 points) Create a method to print the the following image. This method must have one parameter, which is the length of the sides in number of *’s. This method should use only two for loops, and use if statements within the for loops to decide whether to draw a space or a star. You can assume the parameter is an odd number. Draw the outline of a square as follows: N.B. It is normal that the square does not appear to be a perfect square on screen as the width and the length of the characters are not equal. Warm-up Question 2 (0 points) Change the method you just created to have two parameters, so that you can create rectangles. The first parameter will be the height of the rectangle, and the second parameter will be the width of the rectangle. Warm-up Question 3 (0 points) Write a program to display the (x,y) coordinates up to (9,9) of the upper right quadrant of a Cartesian plane. As in the previous warm-up question, your solution should use two nested for loops. Your program should also display the axes, by checking to see if the x-coordinate is zero or if the y-coordinate is zero. Note that when both the x and y coordinates are zero, you should print a + character. For example, the output of your code should look like: Note that in the above image, all of the coordinates containing 0’s are not displayed, since we are printing axes instead. Warm-up Question 4 (0 points) Page 3 Write a method generateRandomArray() that takes as input an integer n and returns an array of size n. The elements of the array should be random doubles between 0 (included) and 5 (excluded). You can use Math.random() to do this. Warm-up Question 5 (0 points) Write a method getLargestElement() that takes an array of integers as input and returns the largest element inside the array. For example, if the input is: int[] arr= {1, 5, -3, 15, 4}; then getLargestElement(arr) should return 15. Warm-up Question 6 (0 points) Write a method getSum() that takes an array of integers as input and returns the sum of all the elements inside the array. For example, if the input is: int[] arr= {1, 5,-3, 15, 4}; then getSum(arr) should return 22. Warm-up Question 7 (0 points) Write a method countNegatives() that takes an array of integers as input and returns the number of negative numbers inside the array. For example, if the input is: int[] arr= {1,5,-3, 15, -13}; then countNegative(arr) should return 2. Warm-up Question 8 (0 points) Write a method getVowels() that takes a String as input and returns an array characters containing all the vowels from the given string. For example, if the input is: String s = "kangaroo"; then getVowels(s) should return {‘a’, ‘a’, ‘o’, ‘o’}. Warm-up Question 9 (0 points) Create a file called Counting.java, and in this file, declare a class called Counting. This class should ask the user when the computer should stop counting. When should I stop counting to? 10 <---- user="" typed="" this="" i="" am="" counting="" until="" 10:="" 1="" 2="" 3="" 4="" 5="" 6="" 7="" 8="" 9="" 10="" warm-up="" question="" 10="" (0="" points)="" for="" this="" question="" you="" have="" to="" generalize="" the="" last="" question.="" the="" user="" will="" give="" you="" the="" number="" they="" want="" the="" computer="" to="" count="" up="" to="" and="" the="" step="" by="" which="" it="" will="" do="" so.="" when="" should="" i="" stop="" counting="" to?="" 25=""><---- which="" step="" should="" i="" use?="" 3=""><---- i="" am="" counting="" to="" 25="" with="" a="" step="" of="" 3:="" 1="" 4="" 7="" 10="" 13="" 16="" 19="" 22="" 25="" page="" 4="" part="" 2="" the="" questions="" in="" this="" part="" of="" the="" assignment="" will="" be="" graded.="" general="" rules="" for="" the="" hangman="" word="" game:="" (http://en.wikipedia.org/wiki/hangman_%28game%29)="" “hangman="" is="" a="" guessing="" game="" for="" two="" or="" more="" players.="" one="" player="" thinks="" of="" a="" word,="" phrase="" or="" sentence="" and="" the="" other(s)="" tries="" to="" guess="" it="" by="" suggesting="" letters="" within="" a="" certain="" number="" of="" guesses.”="" the="" game="" is="" over="" when:="" the="" guessing="" player="" completes="" the="" word="" or="" guesses="" the="" whole="" word="" correctly,="" or="" the="" number="" of="" tries="" is="" exhausted.="" programming="" question="" #1:="" hangman2="" game="" (only="" to="" guess="" the="" word)="" 1)="" the="" word="" to="" guess="" can="" have="" repeated="" letters.="" 2)="" the="" word="" to="" guess="" is="" not="" case="" sensitive,="" and="" only="" up="" to="" a="" maximum="" of="" 10="" characters.="" 3)="" the="" guessing="" player="" has="" 10="" tries="" to="" find="" the="" letters.="" 4)="" the="" player="" can="" guess="" the="" entire="" word="" in="" one="" shot,="" at="" any="" time="" of="" the="" game,="" or="" s/he="" must="" can="" guess="" and="" write="" one="" letter="" at="" a="" time.="" recommended="" skeleton="" of="" the="" structure="" of="" your="" program="" (refer="" to="" screen="" shots="" for="" examples):="" 1)="" a="" player="" enters="" the="" word="" to="" guess.="" remember="" a="" word="" can="" only="" have="" letters.="" 2)="" print="" 20="" blank="" lines="" to="" clear="" hide="" the="" word="" to="" guess="" from="" the="" screen,="" before="" guessing="" player="" starts.="" 3)="" guessing="" player="" (the="" other="" player)="" is="" shown="" with="" stars="" for="" the="" number="" of="" letters="" in="" the="" word="" to="" guess.="" your="" program="" also="" shows="" the="" number="" of="" guesses="" left="" as="" well="" as="" a="" list="" of="" the="" letters="" still="" not="" picked="" (see="" sample="" run="" output="" below).="" 4)="" guessing="" player="" is="" prompted="" for="" a="" letter.="" 5)="" as="" long="" as="" the="" input="" is="" more="" than="" one="" character="" long,="" is="" not="" a="" letter="" or="" is="" a="" letter="" that="" was="" already="" tried,="" your="" program="" should="" keep="" on="" prompting="" the="" user="" for="" valid="" input.="" incorrect="" entries="" should="" not="" be="" counted="" as="" guesses.="" 6)="" once="" a="" valid="" letter="" is="" entered,="" your="" program="" (a)="" updates="" the="" list="" of="" letters="" (alphabet)="" still="" left="" to="" try="" by="" removing="" this="" letter="" from="" the="" list="" if="" there="" are="" no="" more="" characters="" of="" the="" same="" letter="" in="" the="" word,="" (b)="" reduces="" the="" number="" of="" guesses="" left="" by="" one,="" and="" (c)="" checks="" whether="" the="" letter="" is="" part="" of="" the="" word="" to="" guess.="" if="" it="" is,="" then="" replace="" the="" star="" with="" the="" letter="" in="" the="" appropriate="" position.="" steps="" 3="" to="" 6="" are="" repeated="" till="" all="" letters="" in="" the="" word="" are="" found="" or="" reaches="" 10="" guesses.="" 7)="" your="" program="" name="" must="" be="" “hangman2”="" and="" all="" program="" code="" must="" be="" in="" the="" main()="" method.="" -="" your="" program="" should="" use:="" character="" arrays,="" selections,="" and="" loops.="" your="" program="" shouldn’t="" use="" strings.="" however,="" you="" can="" use="" string="" to="" array="" and="" vice="" versa,="" conversion="" methods="" such="" as:="">.toCharArray() method; and String.valueOf() method to convert String to Character array and vice versa. You can convert an array to string for printing (i.e., display) purpose, and Arrays.equals(, ) for equality. Your program ends with a summary of the game (See sample output). Highlight Highlight Page 5 Here are 2 sample runs to illustrate the behavior of the program. ------------------------------- Welcome to HANGMAN2 ------------------------------- OK Guessing Player ... turn around, while your friend enters the word to guess! Other Player - Enter your word (up to 10 letters only, not case sensitive): Talla< 20="" blank="" lines="" here="">>>> Word to date: ***** (10 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: N Letters to try: ABCDEFGHIJKLMNOPQRSTUVWXYZ Which letter should I check for? A Word to date: *A*** (9 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: N Letters to try: ABCDEFGHIJKLMNOPQRSTUVWXYZ Which letter should I check for? T Word to date: TA*** (8 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: N Letters to try: ABCDEFGHIJKLMNOPQRS*UVWXYZ Which letter should I check for? L Word to date: TAL** (7 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: N Letters to try: ABCDEFGHIJKLMNOPQRS*UVWXYZ Which letter should I check for? a Word to date: TAL*A (6 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: *BCDEFGHIJKLMNOPQRS*UVWXYZ Which letter should I check for? k Word to date: TAL*A (5 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: *BCDEFGHIJ*LMNOPQRS*UVWXYZ Which letter should I check for? b Word to date: TAL*A (4 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: **CDEFGHIJ*LMNOPQRS*UVWXYZ Which letter should I check for? a --> Not a valid request - either not a letter or already guesses. Which letter should I check for? h Word to date: TAL*A (3 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: **CDEFG*IJ*LMNOPQRS*UVWXYZ Which letter should I check for? j Word to date: TAL*A (2 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: **CDEFG*I**LMNOPQRS*UVWXYZ Which letter should I check for? e Word to date: TAL*A (1 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: **CD*FG*I**LMNOPQRS*UVWXYZ Which letter should I check for? b --> Not a valid request - either not a letter or already guesses. Which letter should I check for? n ---------------------------------------------------- Sorry you didn't find the mystery word! It was "TALLA" Goodbye .... -------------------------------------------------- Sample output 1 – Guessing player does not guess the word Page 6 ------------------------------- Welcome to HANGMAN2 ------------------------------- OK Guessing Player ... turn around, while your friend enters the word to guess! Other Player - Enter your word (up to 10 letters only, not case sensitive): Talla< 20="" blank="" lines="" here="">>>> Word to date: ***** (10 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: ABCDEFGHIJKLMNOPQRSTUVWXYZ Which letter should I check for? a Word to date: *A*** (9 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: ABCDEFGHIJKLMNOPQRSTUVWXYZ Which letter should I check for? a Word to date: *A**A (8 guess(es) left) Want to solve the puzzle? Enter "Y" to solve the puzzle, or "N" to guess a character: n Letters to try: *BCDEFGHIJKLMNOPQRSTUVWXYZ Which letter should I check for? t
Answered 4 days AfterMar 14, 2023

Answer To: Microsoft Word - CCCS_300_A2_FALL.docxASSIGNMENT 3 CCCS 300 Due: See Mycourse Please...

Vikas answered on Mar 19 2023
31 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here