Computer Science

A roullette wheel has 18 red, 18 black, and one zero slots. With each play of the game, a gambler bets $1 on red. Gambler’s initial capital is $10. A game is over when the gambler either wins $ 10 (his capital becomes $20) or becomes broke (capital = $0). Create a command button (B8) and assign it to a code to estimate the probability of becoming broke (D8). (use 10,000 simulation runs; you can use the VBA Rnd function as a random number generator) Run

EXPERT ANSWER the code is self explanatory 18 red balls 18 black balls 1 zero slot probability of red ball is 18/37 probability of black ball is 18/37 probability of zero slot is 1/37 generate a random number in 0 to 1 if the number lies between 0 and 18/37 , its a red ball, …

A roullette wheel has 18 red, 18 black, and one zero slots. With each play of the game, a gambler bets $1 on red. Gambler’s initial capital is $10. A game is over when the gambler either wins $ 10 (his capital becomes $20) or becomes broke (capital = $0). Create a command button (B8) and assign it to a code to estimate the probability of becoming broke (D8). (use 10,000 simulation runs; you can use the VBA Rnd function as a random number generator) Run Read More »

4. Write a program to find the frequency of each vowel in a string. Input String: Final Assignment Array: a e i o u Character Frequency 2 1 2 0 0

EXPERT ANSWER Solution: CODE: .MODEL SMALL.STACK 100H .DATA PROMPT_1 DB ‘Enter a string : $’PROMPT_2 DB 0DH,0AH,’No. of Vowels = $’PROMPT_3 DB 0DH,0AH,’No. of Consonants = $’ STRING DB 50 DUP (?)C_VOWELS DB ‘AEIOU’S_VOWELS DB ‘aeiou’C_CONSONANTS DB ‘BCDFGHJKLMNPQRSTVWXYZ’S_CONSONANTS DB ‘bcdfghjklmnpqrstvwxyz’ .CODEMAIN PROCMOV AX, @DATA ; initialize DS and ESMOV DS, AXMOV ES, AX LEA DX, …

4. Write a program to find the frequency of each vowel in a string. Input String: Final Assignment Array: a e i o u Character Frequency 2 1 2 0 0 Read More »

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is allowed to rotated any box to use any two sides as its base.

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is …

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is allowed to rotated any box to use any two sides as its base. Read More »

Using implicit Intents, you are to write a complete Android application, using menus or BottomNavigationView to

Using implicit Intents, you are to write a complete Android application, using menus or BottomNavigationView to 1. Allow the user to send SMS messages to multiple users at the same time.2. Allow the user to send E-mail to multiple users including CC and BCC3. Allow the user to Locate any specific place on Google Map by …

Using implicit Intents, you are to write a complete Android application, using menus or BottomNavigationView to Read More »

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is allowed to rotated any box to use any two sides as its base.

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is …

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is allowed to rotated any box to use any two sides as its base. Read More »

P46. Consider that only a single TCP (Reno) connection uses one 10Mbps link which does not buffer any data. Suppose that this link is the only congested link between the sending and receiving hosts. Assume that the TCP sender has a huge file to send to the receiver, and the receiver❝s receive buffer is much larger than the congestion window. We also make the following assumptions: each TCP segment size is 1,500 bytes; the two-way propagation delay of this connection is 150 msec; and this TCP connection is always in congestion avoidance phase, that is, ignore slow start. a. What is the maximum window size (in segments) that this TCP connection can achieve? b. What is the average window size (in segments) and average throughput (in bps) of this TCP connection? c. How long would it take for this TCP connection to reach its maximum window again after recovering from a packet loss?

P46. Consider that only a single TCP (Reno) connection uses one 10Mbps link which does not buffer any data. Suppose that this link is the only congested link between the sending and receiving hosts. Assume that the TCP sender has a huge file to send to the receiver, and the receiver❝s receive buffer is much …

P46. Consider that only a single TCP (Reno) connection uses one 10Mbps link which does not buffer any data. Suppose that this link is the only congested link between the sending and receiving hosts. Assume that the TCP sender has a huge file to send to the receiver, and the receiver❝s receive buffer is much larger than the congestion window. We also make the following assumptions: each TCP segment size is 1,500 bytes; the two-way propagation delay of this connection is 150 msec; and this TCP connection is always in congestion avoidance phase, that is, ignore slow start. a. What is the maximum window size (in segments) that this TCP connection can achieve? b. What is the average window size (in segments) and average throughput (in bps) of this TCP connection? c. How long would it take for this TCP connection to reach its maximum window again after recovering from a packet loss? Read More »

Problem 2. Write a program to convert an infix expression that includes ∧ ,(),,+,−,∗ , and / to postfix. Given an infix expression in the form of a string str. Convert this infix expression to postfix expression. – Infix expression: The expression of the form A op B. When an operator is in-between every pair of operands. – Postfix expression: The expression of the form A B op. When an operator is followed for every pair of operands. Example: – Input-Infix expression: A+B ∗ (C ∧ D−E) ∧ (F+G ∗ H)−I Output – Postfix expression: ABCD ∧ E−FGHH ∗ + ∧ +I – – Input – Infix expression: A ∗ (B+C)/D Output – Postfix expression: ABC+∗D/

EXPERT ANSWER INPUT :A+B∗(C∧D−E)∧(F+G∗H)−IOUPUT:ABCD∧E−FGHH∗+∧+ICONCEPTS OF STACKS ARE USED HERE TO SOLVE THE PROBLEM

ply the following procedure for solving ALL the TMA problems A. Read and analyze the problem statement. B. Formulate the algorithm using pseudocode and assume any required missed data reasonably. C. Write a C\# application. D. Test, debug and execute the C\# application. E. Run each problem twice with different data sets. F. Copy and paste your code from Visual Studio to the Answer Booklet (don’t put your code as a screenshot). G. Provide Screenshots for both the input and output of each data set. H. Your TMA Answer Booklet should be structured as follows: 1. Problem \# 1 GPA Calculator: 1.1 Algorithm pseudocode 1.2 Complete problem’s application code (Copied) 1.3 Experiment number 1 (Screenshots of both input and output) 1.4 Experiment number 2 (Screenshots of both input and output) 2. Problem \# 2 Fat Percentage Calculator: 2.1 Algorithm pseudocode 2.2 Complete problem’s application code (Copied) 2.3 Experiment number 1 (Screenshots of both input and output) 2.4 Experiment number 2 (Screenshots of both input and output) Develop a C\# application that allows the user to calculate the fat of his daily food. The user should enter: – The total number of calories for a food item – The number of fat grams in that food item Accordingly, the application will calculate and display: – The number of calories from fat – The percentage of calories that come from fat Additionally, the applications categorizes if the food is considered low fat, normal fat, or high fat as the following rule. – If the calories from fat are less than

EXPERT ANSWER

Consider the employee database of Figure 2.17. Give an expression in the rela- tional algebra to express each of the following queries:

Consider the employee database of Figure 2.17. Give an expression in the rela- tional algebra to express each of the following queries: Find the ID and name of each employee who does not work for “BigBank”. Find the ID and name of each employee who earns at least as much as every employee in the …

Consider the employee database of Figure 2.17. Give an expression in the rela- tional algebra to express each of the following queries: Read More »