Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Abhinav and Anjali are playing Rock-Paper-Scissors game. Rock-Paper-Scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper" and "scissors". Based on the shapes the player chooses the outcome of the game is determined. A rock beats scissors, scissors beat paper by cutting it, and paper beats rock by covering it. If the same shape is chosen by both of the players, then it is tie. Write a program to decide the winner of each round of the game based on the shapes the players chose.


Input

The first line of input will be one of the strings "Rock", "Paper", "Scissors", representing the shape chosen by Abhinav. The second line of input will be the sting representing the shape chosen by Anjali..


Output


The output should either be "Abhinav Wins" or "Anjali Wins", based on the winner. If it is a tie, the output should be "Tie".


Explanation


For example, if player1 choice is rock and player2 choice is paper then output is "Player 2 wins"


Describe the difference between a chained conditional and a nested conditional. Give your own example of each. Do not copy examples from the textbook.


Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional. Do not copy the example from the textbook.


Given a string of length N, made up of only uppercase characters 'R' and 'G', where 'R' stands for Red and 'G' stands for Green. Find out the minimum number of characters you need to change to make the whole string of the same colour.



Input

The input will be a single line containing a string.


Output

The output should be single line containing the integer representing the minimum number of characters you need to change to make the whole string of the same colour.


Explanation


For example, if string is "GGGGGGR" . We need to change only the last character to 'G' to make the string same-coloured.then output is 1.


Describe the difference between a chained conditional and a nested conditional. Give your own example of each. Do not copy examples from the textbook.


Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional. Do not copy the example from the textbook.


Write the substitutionDecrypt method. Test your algorithm as shown below. Your code should work for any key.

Sample Output:

CipherText: gsv jfrxp yildm ulc

PlainText: the quick brown fox


The transposition cipher can be generalized to any number of rails. Write a function to implement a three-rail fence cipher that takes every third character and puts it on one of the three rails. Test your algorithm with two sample input as shown below.


Sample:

PlainText: ABCDEFGHI

CipherText: CFIBEHADG



It is late at night, and you decide to get a glass of milk before bed. Try to write

pseudocode describing the process of going to the kitchen and getting the milk. Be

very specific and make sure you have all actions in the correct sequence. For example,

remember you must open the refrigerator door before you reach in to retrieve the milk

container. What if there is no glass in the cupboard? Did you check whether the glass

was right side up before you started pouring? Now consider how many small

decisions you make every day, and consider how involved it would be to write a

program to instruct a robot to do the things you do in a day!


rite and test a JAVA program that merges two heaps together the output should be a heap 


 Write a program thatcan store a student’s first name, last name, five test scores, 
average tests score, and grade. (Use an array to store the test scores.) The program must contain methods 
to calculate test averages, return test averages, calculate grades, return grades, 
and modify individual test scores. The method toString must return test data (including student’s
name, five test scores, average, and grade) as a string. Write a program to calculate students’ average 
test scores and the grade. You may assume the following input data:
Jack Johnson 85 83 77 91 76
Lisa Aniston 80 90 95 93 48
Andy Cooper 78 81 11 90 73
Ravi Gupta 92 83 30 69 87
Bonny Blair 23 45 96 38 59
Danny Clark 60 85 45 39 67
Samantha Kennedy 77 31 52 74 83
Robin Bronson 93 94 89 77 97
Sheila Sunny 79 85 28 93 82
Kiran Smith 85 72 49 75 63

The program should output data as close as possible to the following form:
First_Name Last_Name Test1 Test2 Test3 Test4 Test5 Average Grade
Jack Johnson 85.00 83.00 77.00 91.00 76.00 82.40 B
Lisa Aniston 80.00 90.00 95.00 93.00 48.00 81.20 B
Andy Cooper 78.00 81.00 11.00 90.00 73.00 66.60 D
Ravi Gupta 92.00 83.00 30.00 69.00 87.00 72.20 C
Bonny Blair 23.00 45.00 96.00 38.00 59.00 52.20 F
Danny Clark 60.00 85.00 45.00 39.00 67.00 59.20 F
Samantha Kennedy 77.00 31.00 52.00 74.00 83.00 63.40 D
Robin Bronson 93.00 94.00 89.00 77.00 97.00 90.00 A
Sheila Sunny 79.00 85.00 28.00 93.00 82.00 73.40 C
Kiran Smith 85.00 72.00 49.00 75.00 63.00 68.80 D
Class average = 70.94

Compute 4-point DFT of following signal using (a) metrices method (b) DIT FFT:

x(n) = last four digits of your registration number

Hint: let’s your registration number is 11204316 then x (n) = { 4, 3, 1, 6}


LATEST TUTORIALS
APPROVED BY CLIENTS