Questions
1. Explain how rules are used to facilitate communication. 2. Explain the role of protocols and...

1. Explain how rules are used to facilitate communication.

2. Explain the role of protocols and standards organizations in facilitating interoperability in network communications.

3. Explain how devices on a LAN access resources in a small to medium-sized business network.

In: Computer Science

PESTLE Analysis for Apple Air Pods to enter Vietnam (As if it hadn't yet)

PESTLE Analysis for Apple Air Pods to enter Vietnam (As if it hadn't yet)

In: Operations Management

What characteristics define a "high-risk" population? Provide examples of at least three "high-risk" populations and describe...

What characteristics define a "high-risk" population? Provide examples of at least three "high-risk" populations and describe how they meet the characteristics.

Provide short answers of 100-150 words for the following question. Do not exceed 200 words for your response. Include a minimum of one scholarly resource in addition to the course textbook.

In: Psychology

Ceteris paribus, if a firm’s tax rate is 35%, an decrease of $1200 in interest expense...

Ceteris paribus, if a firm’s tax rate is 35%, an decrease of $1200 in interest expense would result in a change in net income of $_____ and in a change in cash of $ _____.

In: Finance

The last digit of a credit card number is the check digit, which protects againts transaction...

The last digit of a credit card number is the check digit, which protects againts transaction errors. The following method is used to veryfy credit card numbers. For the simplicity we can assume that the credit card has 8 digits instead of 16. Follwing steps explains the algorithm in determining if a credit card number is a valid card.  Starting from the right most digit, form the sum of every other digit. For example, if the credit card is number is 43589795 then you form the sum 5+7+8+3 = 23 2  Double each digit that we have not included in the preceding step. Add all digits of resulting numbers. For example, with the number given above, doubling the digits starting with next to last one, yields 18, 18, 10, 8. Adding all digits in these values yield 1+8+1+8+1+0+8 = 27  Add sum of the two preceding steps. If the last digit of the result is zero, then the number is valid number Write a Java program that implements this algorithm (Designing your solution and perhaps wring the algorithm in pseudocode might be helpful). Your program should ask the user 8 digit credit card number and the printout if the credit card is valid or invalid card Grading Criteria: a) The correctness of your program/solution b) Variable naming (self describing) c) Identification of proper data type and constants (if applicable) d) Appropriate commenting and Indentation.

In: Computer Science

Assume the following: Cash Flow From Assets = Minus $15; Interest payments = $30; Dividends paid...

Assume the following: Cash Flow From Assets = Minus $15; Interest payments = $30; Dividends paid = $25; The firm issued and sold additional stock in the amount of $30. This firm (increased) (reduced) its long-term debt in the amount of $_____.

In: Finance

Question: Use Eclipse to create a clockType with hr, min, sec as private members. You shall...

Question:

Use Eclipse to create a clockType with hr, min, sec as private members.

You shall have 3 files: clock.h clock.cpp and lab1main.cpp

lab1main.cpp shall support the following statements:

clockType c1(15, 45, 30), c2(3, 20); // hour, min, sec

cout << c1; // add whatever to beautify it

cout << c2;

cout << c1+c2;

c2 = c1+c1;
cout << c2;

Need help please!

In: Computer Science

To do this in C++ preferably not in a class but if not possible do in...

To do this in C++ preferably not in a class but if not possible do in a class.

Assignment Specifications

Your assignment is to write a single-player version of the casino card game Blackjack, also known as 21. The goal of the game Blackjack is to get cards whose total value comes closest to 21 without going over. Getting a card total over 21 is called "busting". The player will play against the dealer. There are 3 possible outcomes.

  • Player comes closer to 21 than the dealer or the dealer busts but the player did not bust -> player wins the bet amount.

  • The dealer comes closer to 21 than the player or the player's total exceeds 21 -> player loses. Note if both the player and the dealer bust, then the dealer wins. This is called the "house advantage".

  • Both player and dealer have the same total and neither player busts -> tie, no money is exchanged.

At each round of play, the player will be asked to enter their bet. They will then be given 2 cards. The player will repeatedly be asked if they want to draw another card. The player can continue to draw cards while their total is less than 21. After the player's turn is over, the dealer's cards are shown. The dealer's play is always the same: the dealer will continue to draw cards if their total is less than or equal to 16.

A sample run is shown below. Assume the player starts with $100 and the game ends when the player is down to $0 or their amount exceeds $1,000. Also note the user is prompted to re-enter their bet amount if they try to bet more than they actually have.

Programming instructions

Your program should have a function called draw_card that draws a random card. The function should get a random number between 1 and 13 to determine the rank of the card and another number between 1 and 4 to determine the suite of the card. The card of rank 13 corresponds to a king, the card of rank 12 corresponds to a queen, the card of rank 11 corresponds to a jack and card of rank 1 is an ace. In blackjack face cards (Jack, Queen, King) all count as 10 points towards the card total. The function should return the value of the card to be added to the point total. Aces can be either 11 (high) or 1 (low), depending on which is more advantageous to the player to come closest to 21 without going over. The card variable will contain the description of the card such as "Two of diamonds" or "King of hearts".

You should also have a getSuit and getRank function that takes as input an int that corresponds to a Rank or Suit and returns the string version of that rank or suit. For example, rank 10 would have to return “Jack”. Suit 3 would return “hearts”.

Note: Your rand values should have spades = 0, clubs = 1, diamonds = 2, and hearts = 3.

You should seed srand(333)

Note: In your main you should have a variable that keeps track of the current total for the player and another variable that keeps track of the current total for the dealer. When the draw card function is called you should pass to it a string variable called card and the current total. Your function draw_card will return the value of the card it draws and this value should be added in main to the current total. Note that the total is only used in this function to decide if ace should count as high or low. This function does not return the total! It returns the value of the card that was drawn. You are responsible for adding this value to the total in main. When you call the function draw_card you will also pass it a string called card. After calling the function draw_card this variable card will now have the description of the card, something like "Three of diamonds". Do not output anything in the function draw card! All output should be done in main.

//-------------------------------------------------------------------

// draw_card()

// Uses rand() to draw a card then returns the numerical

// value and card name

//-------------------------------------------------------------------

int draw_card(string &card, //IN - card name

               int drawer_points); //IN - drawer's total points

   

   

/****************************************************************

*

* draw_card()

*_______________________________________________________________

* Simulates the drawing of a card. Passes by reference the

* kind of card (value and suite in string value) as well as

* returns the card's equivalent numerical value (to be added

* to totals in main())

* Also reads current drawer's points to determind value of

* aces

*_______________________________________________________________

* PRE-CONDITIONS:

* &card : passes card info

* drawer_points : reads current drawer's points to determine

* value of ace

*

* POST-CONDITIONS:

* passes card info by reference, returns card numerical value

****************************************************************/

int draw_card (string &card, //card info

                int drawer_points) //current drawer's points

Note: You do not need to account for cases where you draw a 3 and then an Ace giving you a total of 14 (Ace counts here as 11) and then you draw a Queen giving you a total of 24. In real Blackjack you would now revert the Ace back to 1 giving you a total of 14. However, this is too complicated and we will not deal with this issue. Once Ace has been counted as 11 it will stay as 11.

Things to test for:

  • Player busts

  • Dealer busts

  • Player loses all his money (Game Over)

  • Player wins (total is more than $1000)

  • Program halts when appropriate

FAQ

Q: Can the same card come up multiple times?

A: Yes. We will assume that the dealer uses multiple decks so for instance a four of clubs can come up many times in the same hand.?

Q: What happens if the player gets 21 does he automatically win?

A: In real blackjack rules the dealer gets to draw even if the player has gotten a 21. If the dealer also gets a 21 then it is considered a draw.





Example Run

You have $100. Enter bet:

50

Your cards are:

  Ten of Clubs

  Ace of Spades


The dealer's cards are:

  King of Hearts

  Seven of Clubs

The dealer's total is 17.

You win $50.

Play again? (y/n):

y

You have $150. Enter bet:

50

Your cards are:

  Seven of Clubs

  Jack of Hearts

Your total is 17. Do you want another card (y/n)?

n


The dealer's cards are:

  Queen of Spades

  Two of Diamonds

The dealer's total is 12.

The dealer draws a card.

  Five of Diamonds

The dealer's total is 17.

A draw! You get back your $50.

Play again? (y/n):

y

You have $150. Enter bet:

50

Your cards are:

  Nine of Clubs

  Queen of Spades

Your total is 19. Do you want another card (y/n)?

y

You draw a:

  Five of Clubs

Your total is 24. You busted!

Play again? (y/n):

y

You have $100. Enter bet:

100

Your cards are:

  Ace of Spades

  Three of Diamonds

Your total is 14. Do you want another card (y/n)?

y

You draw a:

  Eight of Hearts

Your total is 22. You busted!

You have $0. GAME OVER.

Example

The dealer's cards are:

  Two of Clubs

  Four of Diamonds

The dealer's total is 6.

The dealer draws a card.

  Three of Hearts

The dealer draws a card.

  Two of Clubs

The dealer draws a card.

  Nine of Spades

The dealer's total is 20.

Too bad. You lose $40.

In: Computer Science

What are the popular connecters for video?

What are the popular connecters for video?

In: Computer Science

A. Harrimon Industries bonds have 5 years left to maturity. Interest is paid annually, and the...

A. Harrimon Industries bonds have 5 years left to maturity. Interest is paid annually, and the bonds have a $1,000 par value and a coupon rate of 9%. What is the yield to maturity at a current market price of $816? Round your answer to two decimal places. % $1,151? Round your answer to two decimal places. % Would you pay $816 for each bond if you thought that a "fair" market interest rate for such bonds was 13%—that is, if rd = 13%? You would not buy the bond as long as the yield to maturity at this price is greater than your required rate of return. You would not buy the bond as long as the yield to maturity at this price is less than the coupon rate on the bond. You would buy the bond as long as the yield to maturity at this price is greater than your required rate of return. You would buy the bond as long as the yield to maturity at this price is less than your required rate of return. You would buy the bond as long as the yield to maturity at this price equals your required rate of return.

B.

An investor has two bonds in his portfolio that have a face value of $1,000 and pay a 10% annual coupon. Bond L matures in 19 years, while Bond S matures in 1 year.

  1. What will the value of the Bond L be if the going interest rate is 6%, 8%, and 11%? Assume that only one more interest payment is to be made on Bond S at its maturity and that 19 more payments are to be made on Bond L. Round your answers to the nearest cent.
    6% 8% 11%
    Bond L $   $   $  
    Bond S $   $   $  
  2. Why does the longer-term bond’s price vary more than the price of the shorter-term bond when interest rates change?
    1. The change in price due to a change in the required rate of return increases as a bond's maturity decreases.
    2. Long-term bonds have greater interest rate risk than do short-term bonds.
    3. The change in price due to a change in the required rate of return decreases as a bond's maturity increases.
    4. Long-term bonds have lower interest rate risk than do short-term bonds.
    5. Long-term bonds have lower reinvestment rate risk than do short-term bonds.

In: Finance

9. Create a Web page about your favorite musical group. Include the name of the group,...

9. Create a Web page about your favorite musical group. Include the name of the group, the individuals in the group, a hyperlink to the group’s Web site, your favorite three (or fewer if the group is new) CD releases, and a brief review of each CD. ● Use an unordered list to organize the names of the individuals. ● Use a definition list for the names of the CDs and your reviews.

I would like it on Pink Floyd please I am sick and need help please

In: Computer Science

where should the quality control function be placed in an organization

where should the quality control function be placed in an organization

In: Operations Management

Bragg's Equation Problem X-rays of wavelength .0960nm are diffracted by a metallic crystal, angle of first...

Bragg's Equation Problem

X-rays of wavelength .0960nm are diffracted by a metallic crystal, angle of first order (n=1), is measured to be 17.8. What is the distance (in pm) between the layers of atoms responsible for diffraction?

I do this:

96pm / 2sin17.8 and I keep getting ~173.9pm

The answer is supposed to be 157pm. What am I doing wrong?

In: Chemistry

As you have been examining Office 2013, has anyone come across mention of Office 365 and...

As you have been examining Office 2013, has anyone come across mention of Office 365 and changes from Office 2013 that make you even more intrigued in evaluating Office?

In: Computer Science

WRITE A JAVA PROGRAM: For this lab, you will create a 3 x 7 two dimensional...

WRITE A JAVA PROGRAM:

For this lab, you will create a 3 x 7 two dimensional array to store how many pounds of food three monkeys eats each day in a week. The 2D array is then passed to functions to find total, average and least amount of food consumption, etc. The program then need to display:

  • the average amount of food the three monkeys ate per day

  • the least amount of food eaten all week by any one monkey.

  • each monkey's consumption of food during the week

  • the average of food the 3 monkeys ate on Monday and Saturday.

The general structure of Lab9.java should be similar as follows:

import java.util.Scanner;
import java.text.DecimalFormat;

public class Lab9
{
    public static void main(String[] args)
    {
        //declare necessary constants and variables here
        //......

        //Create a 2D array to hold the pounds of food consumed
        //by each monkey on each day of the week
        //......

        //Use nested for loop to get data and fill in the 2D array
        //......

        //call the findGroupTotal() method and compute
        //the average amount of food the 3 monkeys ate per day
        //......

//call the findLeastAmtFood() method and compute
//the least amount of food eaten all week by any one monkey
//......

         //Find Monkey #1 total consumption of food during the week
        //......

        //Find Monkey #2 total consumption of food during the week
        //......

        //Find Monkey #3 total consumption of food during the week
        //......

        //Find the average of food the 3 monkeys eat on Monday
        //......

        //Find the average of food the 3 monkeys eat on Saturday
        //......
    } //end main()

    //This method takes a 2D array as input parameter and returns
    //the sum of all elements inside
    public static double findGroupTotal(double[][] a2DArray)
    {
        //......
    }

//This method takes a 2D array as input parameter and returns
//the smallest element inside
public static double findLeastAmtFood(double[][] a2DArray)
{
    //......
}

} //end of class

1.2 Step 2: Declare necessary variables, constants and a 2D array inside the main()

For this section of the lab, you will need to declare two (2) constants, both are integers, one for the number of monkeys (3), another for the number of days (7). You also need to declare a Scanner object that is used to read data from the user, and also a DecimalFormat object which will be used to format all double variables' output. Note: in this lab, all output need to be formatted with 2 decimal digits.

// For example, declare a constant that hold the number of monkeys.
final int NUM_MONKEYS = 3;

// declare a constant that hold the number of days (7 days).
// ----

// declare a Scanner object which will be used to get user input
// ----

// declare a DecimalFormat object which will be used to format the output
// ----

// declare and create a 2D array called 'food' that holds the pounds of food consumed
// by each monkey on each day of the week

// ----

As we learned in class, for example, to declare and create a two dimensional array, the syntax is as follows.

data_type[][] ArrayName = new data_type[NUM_OF_ROWS][NUM_OF_COLUMNS];

For Lab9, the data type is the pounds of food each monkey ate on a specific day; ArrayName as mentioned above, is food, the number of rows corresponds to number of the monkeys, and the number of columns corresponds to number of days in a week.

1.3 Step 3: Read in data from user and fill in the 2D array

Next, use the Scanner object created in the previous step to ask the user to enter the pounds of food ate by each of the 3 monkeys in each day of the week. i.e. we will need to fill in the 2D array 'food' we created in the previous step row-by-row, and for each row, we need to fill in the data from left to right. Remeber that we should always print a message indicating what is to be input before requesting information from the user. To do this task, we will need to write a nested for loop, the outer for loop iterates on each of the monkeys, where the inner for loop iterates on each of the day in one week.

for (/* loop logic - iterate on each of the 3 monkeys */)
{
    System.out.print("\nEnter pounds of food eaten by monkey #" + //---- + " on \n");
    for (/*loop logic - iterate on each day of the week */)
        {
        System.out.print( " on day " + //---- + ": ");
        //use Scanner object to get user input and store it inside 2D array 'food'
        food[monkey][day] = scan.nextDouble();
        }
}

//Codes in step #6 to step #8 continue......

1.4 Step 4: Design the findGroupTotal() method

Up to above step 3, codes should be put inside the main() method. In order to call findGroupTotal() method in main(), we need to design findGroupTotal() first. This method need to be put outside of the main(), but within the same class. The header of the method is as follows:

public static double findGroupTotal(double[][] a2DArray)

Basically this method takes a two dimensional array as input and returns the sum of all its elements inside. As we learned in class, in order to do this, we will need to write a nested for loop, the outer for loop iterates on each of the rows, where the inner for loop iterates on each of the columns of the 2D array. Very similar as we did in step #3. Note:

  • a2DArray.length equals to the number of rows
  • a2DArray[0].length equals to the number of columns.

double total = 0.0;

for (/* loop logic - iterate on each of the row */)
{
    for (/* loop logic - iterate on each of the colunms */)    
        total += a2DArray[row][column];
}
return total;

1.5 Step 5: Design the findLeastAmtFood() method

Similar as we did in step #4, in order to call findLeastAmtFood() method in main(), we need to design findLeastAmtFood() method first. This method need to be put outside of the main(), but inside the Lab9.java class. The header of the method is as follows:

public static double findLeastAmtFood(double[][] a2DArray)

Basically this method takes a two dimensional array as input and returns the smallest elements inside. As we learned in class, in order to do this, we will need to write a nested for loop, the outer for loop iterates on each of the rows, where the inner for loop iterates on each of the columns of the 2D array. Very similar as we did in step #4, except that we need to declare and intialize a local variable leastAmt as follows:

double leastAmt = a2DArray[0][0];

for (/* loop logic - iterates on each of the rows */)
{
    for (/* loop logic - iterate on each of the columns */)
        {
        if (a2DArray[row][column] < leastAmt)
            //replace leastAmt with the two-D array element at (row, column)
        }

}
return leastAmt;

1.6 Step 6: Call findGroupTotal()and findLeastAmtFood() methods in main()

Continue on what we have left in step 4, now we need to call findGroupTotal() and  findLeastAmtFood() methods on the two-dimensional array food. Since both method returns a double value, you might need to declare any necessary variables to hold the returned value, such as the following:

double groupTotal;

When we call a method with 2D array as input parameter, we just need to plug in the actual parameter's name, such as the following:

groupTotal = findGroupTotal(food);    //find total on 2D array food

Next, you need to do simple computation to find the average amount of food ate per day by the entire family of monkeys, which equals to the groupTotal divided by number of days, then output the computation result according to the test cases.

Similarly, call findLeastAmtFood()method on two dimensional array food, declare any necessary local variables here and output the result as test cases show.

1.7 Step 7: Find each of the monkey's consumption of food during the week

Still inside the main() method, for 2D array food, we need to find the sum of each of the rows, this corresponds to each of the monkeys' consumption of food in the whole week. Use monkey #1 as an example, first we declare a local variable totalOne which will be used to hold monkey #1's total consumption,

double totalOne = 0.0;

Next, we write a for loop which iterates on each of the days in a week (column of 2D array food) and sum the elements one-by-one as follows:

for (int day = 0; day < NUM_DAYS; day++)
    totalOne += food[0][day];

we then output the result on screen:

System.out.print("\nMonkey #1 eat total of " + fmt.format(totalOne) + " pounds of food in this week.\n");

//Follow above monkey #1's example, compute and output monkey #2 & #3's total consumption of food in one week

//----

1.8 Step 8: Find the average of food the 3 monkeys eat on Monday and Saturday

Continue on above step 7, we now need to find the total amount of food the 3 monkeys ate on Monday or Saturday, this corresponds to sum of all elements in column 0 and 5 of 2D array food respectively. Always keep in mind that index starts from 0!

Let's compute the average of food the three monkeys ate on Monday first, we declare a local variable totalMonday which will be used to hold the total consumption, on Monday

double totalMonday = 0.0;

Next, we need to write a for loop which iterates on each of the monkeys on Monday (row of 2D array food), note for Monday, the column index is 0,

for (int monkey = 0; monkey < 3; monkey ++)
        totalMonday += food[monkey][0];

Last, we compute the average and output accordingly,

double averageMon = totalMonday / 3.0;

//Follow above Monday example, compute and output the average of food the three monkeys consumed on Saturday.

//----

In: Computer Science