Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1. Write a program that enables a user to enter in a desired sum for two dice, and then simulates the rolling of two dice until the sum is rolled. After each pair of rolls the program should output what the rolls were and the sum. For example:

2. You are now working for baseball statistics company in need of a new program for computing a baseball batter's slugging percentage.
A batter's slugging percentage is based on the number of opportunities they have to hit the baseball, also called their at bats, and how many bases they touched at each of those at bats.

For example, if a baseball player is at bat and they hit the ball for a double, this indicates they touched two bases. If the player gets a home run, this indicates they get to touch four bases, the maximum possible. If the player is at bat and they do not get a hit, then they touch 0 bases. We then compute the slugging percentage as the total number of bases the player touched divided by the number of at bats they had.

Your program will prompt a user to enter the number of bases touched for each of a player's at bats (i.e., 0, 1, 2, 3, or 4) until they enter a -1 to stop entering bases touched. Then the program should report the total number of at bats entered and the slugging percentage.

3. You are to build a text-based version of the game Mastermind (Links to an external site.)Links to an external site.. The game is played with two-players: the code master and the code breaker.

The code master chooses four different colored pegs to form a code. The pegs can be any of six colors: Red, Orange, Yellow, Green, Blue, Purple. For example the code master might choose Orange, Orange, Blue and Purple as the four peg code. We could abbreviate this code as OOBP.

The code breaker then makes guesses to try and determine the code. For example, the code breaker could guess Blue, Yellow, Orange, Purple, which we could abbreviate as BYOP. After the guess is made, the code master provides two types of feedback on the guess:

1. a count of how many colored pegs are in the correct position (e.g., if the code is OOBP and the guess is BYOP, then the Purple peg is in the correct position so the master would say 1 peg is in the correct position)

2. a count of how many pegs are a color in the code, but in the wrong position (e.g., if the code is OOBP and the guess is BYOP, then the Blue and Orange pegs in the guess are present in the code but in the wrong positions, so the master would say 2 pegs are the correct color).

One important thing to notice: if the code is OOBP and the guess is BOOO, then the feedback should 1 peg is in the correct position (the first O in the guess) and 1 peg is the correct color but in the wrong position, not 2. The O's in the 3rd and 4th position of the guess should not both be counted because there are only two O's in the code and one of them is already covered by the O in the correct position. (Frankly, this is the most difficult part of this assignment and it is strongly recommended you work out the other portions of this program before you get bogged down in this problem.)

4. You are to build a text-based version of the game Mastermind (Links to an external site.)Links to an external site.. The game is played with two-players: the code master and the code breaker.

The code master chooses four different colored pegs to form a code. The pegs can be any of six colors: Red, Orange, Yellow, Green, Blue, Purple. For example the code master might choose Orange, Orange, Blue and Purple as the four peg code. We could abbreviate this code as OOBP.

The code breaker then makes guesses to try and determine the code. For example, the code breaker could guess Blue, Yellow, Orange, Purple, which we could abbreviate as BYOP. After the guess is made, the code master provides two types of feedback on the guess:

1. a count of how many colored pegs are in the correct position (e.g., if the code is OOBP and the guess is BYOP, then the Purple peg is in the correct position so the master would say 1 peg is in the correct position)

2. a count of how many pegs are a color in the code, but in the wrong position (e.g., if the code is OOBP and the guess is BYOP, then the Blue and Orange pegs in the guess are present in the code but in the wrong positions, so the master would say 2 pegs are the correct color).

One important thing to notice: if the code is OOBP and the guess is BOOO, then the feedback should 1 peg is in the correct position (the first O in the guess) and 1 peg is the correct color but in the wrong position, not 2. The O's in the 3rd and 4th position of the guess should not both be counted because there are only two O's in the code and one of them is already covered by the O in the correct position. (Frankly, this is the most difficult part of this assignment and it is strongly recommended you work out the other portions of this program before you get bogged down in this problem.)

5. You are to write a graphical program that tracks if a user clicks inside or outside of a box. In the image below you will notice two blue boxes and many circles. Notice that the blue circles are inside the boxes, and the red circles are outside the boxes.

Your goal is to complete the P4_BoxClick class such that it:

1. draws two boxes (i.e., rectangles)

2. draws a circle where a user clicks on the panel

3. colors the circle blue if the click is inside one of the boxes, or red if it the click is outside one of the boxes

In the P4_BoxClick class I have provided you with a few things:

• The main method creates a DrawingPanel object that is 400 pixels wide by 400 pixels high

• It creates a mouse click handler for which you do not need to worry about the mechanics, all you need to know is that when the mouse is clicked on the panel it will call the `handleMouseClick` method that I provided.

• The `handleMouseClick` method has three parameters: the graphics context object, an x coordinate, and a y coordinate that correspond to the (x, y) location where the user clicked

The location and size of the boxes are up to you, but they must have a minimum width and height of 20 pixels. The circles for the clicks should have a diameter of at least 3 pixels and be drawn centered on the (x, y) coordinate on which the user clicked.
You should not modify the signature of the `handleMouseClick` method. This can lead to a few magic numbers in your solution, but that's okay for this problem.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92774020
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Would be being proposed transfer scheme answer the problems

Would be being proposed transfer scheme answer the problem/s seen in the implementation of the TRAIN law? Explain why or why not in light of the ongoing 4Ps etc. What are some other tax reform in Collas-Monsod's wish lis ...

Question suppose you need to store 10 tb of data in a new

Question Suppose you need to store 10 TB of data in a new data center. How many 2 GB hard disks do you need if the hard disk should store up to 70% of their capacity using RAID 0, RAID 1, RAID 3, or RAID 5.

7 years ago crane corporation issued 20-year bonds that had

7 years ago Crane Corporation issued 20-year bonds that had a $1,000 face value, paid interest annually, and had a coupon rate of 7 percent. If the market rate of interest is 5.5 percent today, what is the current market ...

A medical researcher is interested in determining whether a

A medical researcher is interested in determining whether a new medication for lung cancer is effective in a group of patients with early-stage disease. Explain what a Type I and Type II error would be in this study. (Be ...

Whats the difference between a bigfile tablespace and a

What's the difference between a Bigfile tablespace and a Smallfile tablespace? Explain which you would use for your database and why.

Can someone help me identify how intrustion detection

Can someone help me identify how Intrustion detection system and intrusion prevent system can help protect confidentiality, integrity and availability.

Review questionsrq web server environment kroenke book chap

Review Questions(RQ) Web Server Environment Kroenke Book Chap 11 The Review Questions (RQ) listed below can also be found in the Kroenke textbook, starting on page 526. This is NOT the entire list of Review Questions, bu ...

Given that many new business fail in the first few years

Given that many new business fail in the first few years, how should an entrepreneur think about the risk of failure associated with a new business from what you have learnt? what an entrepreneur do to increase the chanc ...

Case studyjulian lim purchased a put option at the cost of

Case study: Julian Lim purchased a put option at the cost of $0.30 each. The put option has a strike price of S$3.00 and the underlying stock is currently trading at S$3.50. Julian Lim bought 100 shares. Question: Determ ...

Williamnbspis interested in knowingnbspwhether or not

William is interested in knowing  whether or not athletics from his team have lower satisfaction with their team on a survey than the known population average survey score of 19  and the known population survey standard ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As