Computer Science Homework Help
Question 1:Write a method squareOfSymbols that displays a solid rectangle of symbols whose height
Question 1:
Write a method squareOfSymbols that displays a solid rectangle of symbols whose height
and
width are specified in integer parameter height and width respectively. And this method also
receive a third parameter of type char called fillCharacter. For example, if height is 5, weight is
4, and the fillCharacter is *, the method should display
****
****
****
****
****
Incorporate this method into an application that reads an integer value for side from the user
and outputs the asterisks with the squareOfAsterisks method.
Question 2:
Write methods that accomplish each of the following tasks:
A. Write a method called divideQuotient that calculates the integer part of the quotient when
integer a is divided by integer b.
B. Write a method called divideRemainder that calculates the integer remainder when integer
a is divided by integer b.
C. Use the methods developed in parts (a) and (b) to write a method displayDigits that
receives an integer between 1 and 99999 and displays it as a sequence of digits, separating
each digit by two spaces. For example, the integer 4562 should appear as 4 5 6 2
D. Also write a method called displayReverseDigits that is similar to (c), but it displays digits in
reverse order. For example, 2 6 5 4
Incorporate the methods into an application that inputs an integer and calls displayDigits by
passing the method the integer entered. Display the results.
Question 3:
Write an application that simulates coin tossing. Let the program toss a coin each time the user
chooses the “Toss Coin” menu option. Count the number of times each side of the coin appears.
Display the results. The program should call a separate method flip that takes no arguments
and returns a value from a Coin enum (HEADS and TAILS). [Note: If the program realistically
simulates coin tossing, each side of the coin should appear approximately half the time.]