FLEX & YACC hw Please add commentaries inside the code Make calculator also run with float numbers.
Q: setprecision (n) : when used in conjunction with fixed, set the number of digits after the decimal…
A: Below is the code and sample output:
Q: Q2. (a) Write parametric equation to draw a circle using midpoint circle drawing algorithm and then…
A: Mid Point Circle Drawing Algorithm attempts to generate the points of one octant.
Q: PYTHON ONLY Please create a code that checks if 'user' favourite game is in the top 3 games. if…
A: Answer:
Q: Hello can you please help me figure out what i did wrong?
A: The program has to be properly intended (Use Tab for indentation) locations has to be defined or…
Q: L DRAW ACTIVI T Y.
A: Here is the answer below:-
Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File…
A: Note:Example is missing in the question. If you want this program to run for a specified example,…
Q: /* 02: create a variable called name and set it equal to "Sandy\n" Output the variable */
A: Note - As you haven't specified particular programming language to write code in, I have written…
Q: 9. Follow the comments to insert the missing parts of the code below: // Create a checkAge () method…
A: static void ..........(....... ..........){ ...........(..... ......... ........ ){…
Q: Create a Guessing Game, you should have your own number value, for example 58.
A: guessing the number game
Q: Retype or copy, and then run the following code; note incorrect behavior. Then fix errors in the…
A: Please find the answer below :
Q: Assignment4A: Let's Play Bunco! Now that we are able to repeat actions easily with loops, we can…
A: the code is given below:
Q: please Find equivalent mutant and paste the code segment here please
A: solution in step:-2
Q: int num = 0; System.out.println ("Song titles with numbers include: "); switch (num) { case 12:…
A: To do: What will the printout from given
Q: def display(): print("UTAS") def displayNumber(n1, n2): if n1 > n2: return nl * n2 else: return nl -…
A: def display():#this function will return UTAS print("UTAS")def displayNumber(n1,n2):#this…
Q: 29. The number of combinations Chr of taking r objects out of n objects is given by: n! r!(n-r)! Cnr…
A: To find the number of combinations(C59,5 * C35,10 in the powerball lottery. Factorial(n) is a…
Q: Please return the angle in degree format Not in radians format. Please do fast. I have no time left…
A: The answer given as below:
Q: Balance is: 26000 0 Date -day:int -month:int year:int +getDay()int +getMonth():int +getYear()int
A: import java.util.*;class employee{ private String employeid; private String empname;…
Q: What is the output of the following code?
A: The ostream class is represented by the C++ cout expression. It's utilized to generate output for…
Q: separate .py def triangle(base, height): area=0.5*base*height print("Triangle Area: ", area) def…
A: The above question is solved in step 2 :-
Q: alate the value of
A: The big-O notation is a type of asymptotic notation that is used to describe the order of growth of…
Q: #include using namespace std; int getRandom () { //generate a seeded random number //between 1 and…
A: 1) Below is completed program demonstrating function calling another function It defines function…
Q: Assignment: Sidewalk Have Turtle draw a sidewalk around the perimeter of 400x400 px The sidewalk…
A: Answer: I have done code and also I have attached code and code screenshot as well as output
Q: switch_player(): we will allow the players to choose their own names, but for our purposes, it is…
A: Python is a high-level, object-oriented programming language. Python is a dynamic data type…
Q: rite MATLAB code. You have to take n-10 and X=100.. Atach screenshot as well
A: According to the question we have to write MATLAB code for the following question: In this code, the…
Q: 28- Every variable should be separated by separator. • Dot Colon • Comma Semicolon
A: Every variable should be separated by Comma operator. Answer: Comma
Q: After every word on a line is spellchecked, it should be written to an output file called…
A: Solution: Note: I have implemented all the things. Please read the code carefully and if you have…
Q: Pls. add a comment (# this is a comment) on each line or block to briefly explain what it does.…
A: Lets see the solution.
Q: ello, Can someone please help me with this code. Its adding another line to each year.
A: The given problem is related to Python programming where the program is already provided to take…
Q: 6. Add 10 string variable definitions.
A: Program Approach: In C#, strings can be defined using string keyword. Strings values can be…
Q: PYTHON ONLY Please finish off this movie collection progam/code a) define print_longest_movies To…
A: Answer:
Q: 3. Show the Huffman Code for each character in the following string. “boss demigoddess ship”
A: We are given a string and we are asked the Huffman code for each character. First, we will check…
Q: Create a VB.NET Console Application that uses the While loop to display all leap years between 2010…
A: Algorithm: 1. Start 2. Initilaize y to 2010 3. Using while loop traverse from 2010 to 2050 4. Inside…
Q: What does the following error message normally mean: IndentationError: unexpected indent Select one:…
A: Introduction: When writing python code, we have to define a group of statements for functions and…
Q: if user_tickets< 5: num_tickets=1 else: num_tickets= user_tickets
A: Purpose: Check whether a number "user_tickets" entered by user is less than 5 or not. If yes then…
Q: Print numbers 0, 1, 2,., userNum as shown, with each number indented by that number of spaces. For…
A: #include <iostream> using namespace std; int main(){ int unum; int i,j;…
Q: Please draw the working of this semaphore.
A: A semaphore is an integer variable, shared among multiple processes used for process synchronization…
Q: Test Case 4 How many integers do you have? (Max 20) \n -40 ENTER You must enter a number in between…
A: - We need to highlight the correct code for the given scenario.
Q: can u please send screenshot of code for the alignement/ indentation
A: - The code screenshot with indentation is requested here.
Q: Rust Lab Assignment - 2 Write a program to compute the sum of all even natural numbers in the range…
A: Here I have created a variable to store the sum of even numbers. Next, I have used a for loop to…
Q: (True/False): The USES operator only generates PUSH instructions, so you must code POPinstructions…
A: Explanation: The USES operator is used to list the name of all registers changed within a…
Q: 1- Enter two values ( x and y) then print the square root value of (x) when (x-y)<10 otherwise print…
A: NOTE: As per our guidelines we are supposed to answer only one question so please post the another…
Q: Using functions Create a tic-tac-toe using python programming just by applying some core concepts.…
A: Code: import random theBoard = {'7': '7', '8': '8', '9': '9', '4': '4', '5': '5', '6':…
Q: fix code and remove errors
A: SUMMARY: - Hence, We discussed all the points.
Q: int sum(int x, int y) - returns the computed sum of two integers x and y int diff(int x, int y) -…
A: the program is given below :
Q: Fill-in-the-Blank A(n) __________ is a special value that marks the end of a series of values.
A: sentinel
Q: 1- The integers from 100 down to 0 by fives; that is, the first three lines should be 100, 95, 90,…
A: The program used the for loop to print the numbers fro 100 to 0 multiples of 5. For loop starts from…
Q: • The individual ticket price for Small Monster Collectors is $9.50. • The individual ticket price…
A: Step 1: Prompt and accept the value of number of moviegoers from the user. Step 2: Check whether the…
Q: 7. username_ends_with_digits This function decides whether a given username ends with some digits.…
A: The Python code along with the screenshot of code and output is given below.
FLEX & YACC hw
Please add commentaries inside the code
Make calculator also run with float numbers.
Step by step
Solved in 2 steps with 6 images
- Using the starter code below, write a program that asks a user for two points (x1, y1) and (x2, y2), then computes the area of the circle for which (x1, y1) is the center and (x2, y2) is on the circle's perimeter. The program should define and use 3 functions: distance(x1, y1, x2, y2): computes and returns the distance between two points • area(r): computes and returns the area of a circle with radius r • main(): asks user for input, calls the other functions, and prints the answer. The input and output of the program should look similar to this: X for center point: 0 Y for center point: 0 X for perimeter point: 1 Y for perimeter point: 1 Area of circle centered at (0.0, 0.0) with radius 1.414213 is 6.283185. Hint 1: Area of a circle = n? Hint2: Distance between 2 points = sqrt(x2-X12 + (Y2 - Y1)²) Starter code: import math def distance(x1, y1, x2, y2): #Add code to compute and return distance between (x1, y1) and (x2, y2) def area(r): #Add code to compute and return area of circle…Rest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working.// Use function to display menu, and display game rules,// Use different color for text display.// fix it so it works any way you like./*HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7);*/#include <iostream>#include <windows.h>using namespace std;int main(){ //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<<endl; cout << "*…Using a Sentinel Value to Control a while Loop in Java Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the file named MovieGuide.java is open. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop to calculate the average star rating. Execute the program by clicking Run. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Check that the…
- * Question Completion Status: A Moving to another question will save this response. Question 9 Given the function F(X,Y,Z) =XZ + Z(X'+ XY), the equivalent, most simplified Boolean representation for F is O a. Z+XYZ O b.XZ O c. Z O d.Z+YZ A Moving to another question will save this response. مشمس 36°CDebugging: Find the error if there's any and rewriteAssignment4B: Diamonds in the sky. In our earliest labs, we asked you to print a diamond pattern to the screen using predefined print statements. Now that we know how to use loops, we can make more dynamic and customizable patterns. For this assignment, we will prompt the user to enter a maximum width for the diamond. If they enter a number less than 3, we'll prompt them to choose a correct width. If they enter an even number (greater than 3), we will add 1 to it and let the user know the final diamond size. Then we will generate and print out the diamond using * and '' symbols. Hints: Each line of the "diamond" is made up of two parts – the asterisks in the center and the spaces to the left of it. The amount of "left space" decreases as we go towards the middle diamond, then increases afterwards as we go towards the bottom. Could we use multiple loops (or even nested loops) to model this behavior? Also, note that the number of asterisks increases (and later decreases) by two on each…
- e11: Find the value of A for the following: A = (5 + 2* 3+ (( 3-2)* 7)+ -9) /2.pleasse can you do a code for thisCyclops numbersdef is_cyclops(n):A nonnegative integer is said to be a cyclops number if it consists of an odd number of digits so that the middle (more poetically, the “eye”) digit is a zero, and all other digits of that number are nonzero. This function should determine whether its parameter integer n is a cyclops number, and return either True or False accordingly n Expected result 0 True 101 True 98053 True 777888999 False 1056 False 675409820 False
- 4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice. The user should be able to choose to roll eg 4 dice and test the probability of a selected score eg 11. The program should then do a number of simulations and answer how big the probability is for the selected score with as many dice selected. There must be error checks so that you cannot enter incorrect sums, for example, it is not possible to get the sum 3 if you roll 4 dice. TarningsKast2 How many dices do you want to throw? 11 Which number do you want the probability for? The probability the get the number 11 with 4 dices is 7.19% CalculateMicrofost Visual C# 7th edition programming exercise 6-10. I need help, please. This problem relies on the generation of a random number. You can create a random number that is at least min but less than max using the following statements: Random ranNumberGenerator = new Random();int randomNumber;randomNumber = ranNumberGenerator.Next(min, max); Create a game similar to Hangman named GuessAWord in which a player guesses letters to try to replicate a hidden word. Store at least eight words in an array, and randomly select one to be the hidden word. Initially, display the hidden word using asterisks to represent each letter. Allow the user to guess letters to replace the asterisks in the hidden word until the user completes the entire word. If the user guesses a letter that is not in the hidden word, display an appropriate message. If the user guesses a letter that appears multiple times in the hidden word, make sure that each correct letter is placed. Figure 6-27 shows a typical game…QUICK-BASIC64 In a 50-person class, students with grades below 70 are considered unsuccessful. Write an algorithm that calculates students who fail the exam. (Please explain everything the program in details and please check whether the program runs or not by using q- basic64. Thank you so much)