Computers and Technology Quiz & Practice Tests - Test Your Skills
In C++ please.If the hypotenuse and one leg of a right triangle are equal to the hypotenuse and one leg of another right triangle, then the two right triangles are congruent.Assume that you are given a function called rightTriangle. It takes three sides of a triangle (the third parameter is the largest, so it will be the hypotenuse if the triangle is a right triangle) and returns true if the triangle is a right triangle and false otherwise. YOU DO NOT HAVE to WRITE THIS FUNCTION. YOU HAVE IT!Also assume that you have a function called equalNums. It takes 4 parameters, if the first 2 are == to the last 2, the function returns false, otherwise the function returns true. So if we send it 3 5 3 5 the function returns true. You do not have to write this function, you have it!Assume that the following variables are declared for two triangles and have values and we know that the 3rd side is the largest side:int triangle1Side1, triangle1Side2, triangle1Side3;int triangle2Side1, triangle2Side2, triangle2Side3;1. Write code in main (using the two functions that you have) to print out whether of not these two triangles are right congruent triangles. (remember that to be right congruent triangles, both triangles need to be right triangles and the hypotenuse and leg of one need to be == to the hypontenuse and leg of the other).
Consider the following relational schema, where the primary keys are Bold, Students(sid, sname, address, dept_id) Courses(cid, cname, dept_id) Departments(dept_id, dname, college) Grades(sid, cid, year, semester, grade) Write the following queries in SQL. Only use the tables that are absolutely needed for the corresponding query. 1. Find the sids and snames of students who took "Database" course (i.e., cname = Database) in Fall 2019. 2. Find the average grade of all the students who took "CS327" (i.e., cid=CS327) in Fall 2019. You can assume grade is a numerical attribute. 3. Find the number of distinct courses offered by each department in Fall 2019. 4. Find the sids of students who have taken at least 10 different courses offered by "Computer Science" department (i.e., dname = Computer Science).
In C++ programming please.Rock, Paper, Scissors Game.a) Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows:1. When the program begins, a random number in the range of 1 through 3 is generated (1+rand()%3). If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, them the computer has chosen scissors. (Don't display computer's choice yet).2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. (You can use a menu if you prefer).3. The computer's choice is displayed.4. A winner is selected according to the rock paper scossors game riles.Be sure to divide the program into the following functions: int getUserChoice ();The getUserChoice function displays a menu allowing the user to select rock, paper, or scissors. 4 to Quit the game The function then returns 1 for rock, or 2 for paper, or 3 for scissors. User input validation of the choicesint getComputerSchoice (); The getComputerChoice function returns the computer's game choice.It returns 1 for rock (via the ROCK constant), or 2 for paper (via the PAPER constant), or 3 for scissors determineWinner (int, int);The determineWinner function accepts the user's game choice and the computer's game choice as arguments and displays the choices, and a message indicating the winner. void displayChoice (int);The displayChoice function accepts an integer argument and displays rock, paper, or Scissors. int main () Loop while user choice is not 4 (Quit the game)
In this lab, you will design a die game called 15. The object of the game is to score exactly 15 points in as few rolls of the die as possible. After each roll, the player can choose to add the current die value to his or her score or not, unless the die value is six, in which case it is automatically added to the players score. If the players score exceeds 15, the player loses. If the players score is equal to 15, the player wins. Play continues until the player reaches or exceeds 15 points.Description:To start the game, the player presses the reset switch. The score will be set to zero and both the Win and Lose LEDs will be turned off. The player then rolls the die by toggling the Rb switch to the Roll position. The die counter should operate with a clock frequency of 27 MHz or 50 MHz so that the player cannot control the outcome of a roll. After about a second or more, the player toggles the Rb switch back to the Off position to end the roll. The Turn Counter should be incremented to indicate that the player has taken a roll. If the player rolled a six, it is automatically added to his or her score. Otherwise, the player can press the Add button to add the die value to his or her score or the player can press the Pass button to leave the score unchanged. After each roll, the score will be greater than, less than or equal to 15. If the score is equal to 15, the player wins the Win LED should be turned on and remain on until the system is reset for a new game. If the score is greater than 15, the player loses the Lose LED should be turned on and remain on until the system is reset. Once the player has won or lost, the player cannot roll the die again until the system is reset. (The Rb switch will not have any effect in these states.) If the score is less than 15, the player will roll again. After each roll, the player presses either the Add button or the Pass button (unless a six is rolled) before the die can be rolled again. Play continues until the players score equals or exceeds 15.1) Draw a state diagram for the game as a Moore finite state machine.2) Draw a state diagram for the game as a Mealy finite state machine.
Let a and b be two vector. i.e. a and b are two vectors, of possibly different sizes, containing integers. Further assume that in both a and b the integers are sorted in ascending order. 1. Write a function: vector merge( vector a, vector b) that will merge the two vectors into one new one and return the merged vector. By merge we mean that the resulting vector should have all the elements from a and b, and all its elements should be in ascending order. For example: a: 2,4,6,8 b: 1,3,7,10,13 the merge will be: 1,2,3,4,6,7,8,10,13 Do this in two ways. In way 1 you cannot use any sorting function. In way 2 you must.