4. A newly opened college ground is rectangular in shape and the Management decides to build a fence around the ground. In order to help the construction workers to build a fence, they planned to place a thick rope around the ground. They also wanted to cover the entire ground with a thick carpet during rainy season. They wanted to buy only the exact quantity of carpet and rope that is needed. They requested your help. Please help them by writing an algorithm and 'C' program to find the exact length of the rope and the exact quantity of carper that is required. Length and width should be a positive number.
Q: The manager of Mama Calari’s Pizza Palace wants a program that calculates and displays the number of…
A: The manager wants to calculate the number of pizza slices into which the pizza can be divided.…
Q: Hello, welcome to the Code Blasters code-writing competition! So, let's start with the exercise…
A: Input-Output Explanation: The first line of the input contains a single integer TT .TT denoting the…
Q: During this COVID-19 pandemic, doctors have advised that a person can check the health of his/her…
A: Algorithm: Start Read no.of frequencies n Read n frequencies and n periods of holding breath in…
Q: write the algorithm for the problem below. Suppose that h(t) = 0.12t4 + 12t3 - 380t2 + 4100t + 220…
A: C++ program to create a table of the height at time t for t = 0 to 24. Algorithm: Start In the…
Q: While carpet shopping for her living room, Carol Jones noticed that some carpet prices are per…
A: Input: Floor's measurement in feet Output: Floor's Area in feet and yard Algorithm: - Enter the…
Q: When analyzing data sets, such as data for human heights or for human weights, a common step is to…
A: The answer is
Q: Jack is the head of his section. He looked tensed due to some reason. One of his friends asks him…
A: Objective: This program reads marks of 7 subjects each out of 35 and computes the average of those…
Q: The programming language is C++, write a program for each items base on the given statement. 1.…
A: Code: #include <iostream>using namespace std; int main() { int grade, newGrade; cout <<…
Q: Suppose that one of the biggest car sales companies promised you an offer. Therefore, they have…
A: #include <iostream>#include <string>#include <fstream>using namespace std; int…
Q: What answers do you get for below queries for given program. Program : vegetarian(jose).…
A: As i have read Bartleby guidlines i can provide answer of only 1 part of questions in case of…
Q: The program below simulates tossing a fair coin N times. The program computes the longest sequence…
A: Let's see step by step: 1. const int HEADS = 0; const int TAILS = 1; here HEADS is initialized…
Q: this is a problem that I have how would I go about solving it?Im using python so please put the…
A: Algorithm: Initializes the seat prices for class A, B and CDefine main function.Display message…
Q: 1. You are working for the census bureau and you need to write a program to count the number of…
A: Note: We are authorized to answer two questions at a time. Since you have asked more than one…
Q: Develop a design in C++ that leads to an algorithm and a programthat will readin a positive integer…
A: #include<bits/stdc++.h>using namespace std;bool PowerOfTwo(int n){if(n==0)return false; return…
Q: Jerry Feingold wants a program that will help him calculate the amount to tip a waiter at a…
A: Create a class Tip. Declare variables to hold the values of total bill, liquor charge, tip…
Q: This example is a simple assembly language program to calculate some geometric information for each…
A: ; Example assembly language program to calculate the ; geometric information for each square pyramid…
Q: A university recently conducted a survey with regards to demographics and programmes in which…
A: Please refer below code for explaination as comments are given below: // Online C compiler to run C…
Q: 39. Write a program for the following problem. An instructor needs a program that accepts a student…
A: Given : semester average grade 90 -100 A 80-89 B 70-79…
Q: I want to solve the question in c++ Exercise 5 Part1: • Write a program that presents to the…
A: Find the required code given as below and output :
Q: odify the guessing-game program so that the user thinks of a number that the computer must guess.…
A: Given: odify the guessing-game program so that the user thinks of a number that the computer must…
Q: So the problem I have to do is create a fast food-ordering program that calculates the cost…
A: Step-1: StartStep-2: Declare an int variable choiceStep-3: Declare an bool variable point with…
Q: First Aid are asked. Passing grade in driver's license exams is 70 out of 100. A student who scores…
A: // t refers traffic, e refers engine, f refers first //aid print("Enter the traffic wrong…
Q: In C++, write a program whose inputs are three integers, and whose output is the smallest of the…
A: Given To complete the c++ program to find the smallest numbers from three integers.
Q: In an ancient land, the beautiful princess Eve had many suitors. She decided on the following…
A: Iam using list instead of vector. c++
Q: Q3/B/ Write a program in C++ to read an integer number then find the area or circumference of a…
A: Since Algorithm is already given in the problem, I am not writing it. Program: #include…
Q: Assignment:Write a C++ program that computes a student’s grade for an assignment as a percentage…
A: Answer #1 #include <iostream> #include <fstream> //for inputting the file #include…
Q: Task 1 Write a Python program that will ask the user to input a string (containing exactly one…
A: # As per our guidelines we are supposed to answer only one question. Kindly repost other questions…
Q: Suppose you have a certain amount of money in a savings account that earns compound monthly…
A: Here I have created a function that takes 3 input parameters, compute the future value and return…
Q: b) A sequence of numbers is given by the equation; Xn+2 = Xn+1 + xn Χη, ie if X1 and x2 = 1 then x3=…
A: Since 1st 2 terms are not mentioned, I am using c++. Code: x=zeros(1,12); x(1)=1; x(2)=1;…
Q: Make a C program: After beating the record for the quickest time to beat a Hydra, Cody became a…
A: #include<stdio.h> int main() { int num; printf("Enter the number of Cody's fans : ");…
Q: B) R1= 20, R2=40 resistors are connected in series and R3=120, R4=40 resistors are connected in…
A: the answer to above question:
Q: Hey i need help with coding in c++ Q1 // with steps Write a program that determines a student’s…
A: Approach for the program- 1)Import the essential headers.2)Define the main function.3)Declare the…
Q: A common problem in health informatics is to read a message from another healthcare organization and…
A: In order to solve the problem we would follow these steps:Break the entire string into tokens…
Q: Write a c program: Find a number that is greater than 3 (prints until a number than 3 is…
A: ANSWER: C Program: C is a significant level and broadly useful programming language that is great…
Q: public class Turn{public static void main(String[] args){// Different initial values will be used…
A: Equations that are used to replace the value of variable x and y: - The initial values of the…
Q: A group of friends, Billy, Charlie, Sofia, and Temmy, would like to save up for their monthly…
A: The question is to write C++ code for the given question.
Q: An instructor gives a series of exams during the semester in her math class. At the er the semester…
A: Solution :
Q: Each year the Department of Traffic Accidents receives accident count reports from a number of…
A: Algorithm: Start Implement read_Count() which takes a pointer to an array and its size as arguments…
Q: In C++
A: To write a C++ program for n*n cubes, where the mouse reaches from n1 to n16. 1. To count the…
Q: Q/ A College of engineering is advertised to call high school graduates to apply to its departments…
A: Problem Statement: A College of engineering is advertised to call high school graduates to apply to…
Q: The population of one of Arabia in 1980 was about 12 million, if he learned that an increasing rate…
A: Write the c++ program that will print the three things using the following data, Initial year 1980…
Q: 4. A newly opened college ground is rectangular in shape and the Management decides to build a fence…
A: Algorithm: Step 1: Start Step 2: declare variables l and b Step 3: read l(length), b(width) Step 4:…
Q: nment:Write a C++ program that computes a student’s grade for an assignment as a percentage given…
A: include <iostream> #include <fstream> //for inputting the file #include <string>…
Q: 4. A newly opened college ground is rectangular in shape and the Management decides to build a fence…
A: Algorithm: Step 1: Start Step 2: declare variables l and b Step 3: read l(length), b(width) Step 4:…
Q: QI: Write a program to simulate a simple calculator to execute the operations: +, for addition -,…
A: Print the welcome message and the menu to the user Get the choice as input from the user Run the…
Q: ANSWER IN C++ WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND…
A: Programming in C++: C++ provides many features, standard libraries, rules to solve problems through…
Q: B) R1= 20, R2=40 resistors are connected in series and R3-120, R4=40 resistors are connected in…
A: First of all we would derive some formulas to use in our C++ code, We have to find Currents…
Q: Task 12 Write a Python program which takes a number and prints the digits from the unit place, then…
A: Program description: n is the user input integer variable that stores the value of the number.…
Q: 3) Write a program to find a. Surface area (A= 2 r n) b. volume(v=r ² a h) of a cylinder using…
A: Algorithm: Step-1: Start Step-2: Take input radius and height from the user. Step-3: Calling…
C++
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- Suppose we have a nice young couple who borrow $700000 from the bank, at an annual interest rate of3.124%. The mortgage is a 30 year loan, so they need to pay it off within 360 months total. Our happycouple decide to set their monthly mortgage payment at $2000 per month. Will they pay off the loan intime or not?Note that the monthly balance will be calculated asbalance = (im × previous balance) - monthly paymentwhere the convert annual interest to a monthly multiplier im is calculated as im = (1 +i)1/12 and i = annualinterest rate.Write a loop for track the total payment in 360 months so that we can evaluate if the couple can pay off theloan. Write in R Please and thank you.Three prisoners have been sentenced to long terms in prison, but due to over crowed conditions, one prisoner must be released. The warden devises a scheme to determine which prisoner is to be released. He tells the prisoners that he will blindfold them and then paint a red dot or blue dot on each forehead. After he paints the dots, he will remove the blindfolds, and a prisoner should raise his hand if he sees at least one red dot on the other two prisoners. The first prisoner to identify the color of the dot on his own forehead will be release. Of course, the prisoners agree to this. (What do they have to lose?) The warden blindfolds the prisoners, as promised, and then paints a red dot on the foreheads of all three prisoners. He removes the blindfolds and, since each prisoner sees a red dot (in fact two red dots), each prisoner raises his hand. Some time passes when one of the prisoners exclaims, "I know what color my dot is! It's red!" This prisoner is then released. Your problem…You are the TA for the FCP course in environment engineering. You are given the midsem and endsem marks for the N Students in the course. A student P is said to dominate a student Q, if the midsem and endsem marks of P are both greater than the respective midsem and endsem marks of Q. Design an efficient algorithm for finding all the students that are not dominated by any other student in the class. Analyse the time complexity as well
- Implement an algorithmic solution, indicating which states are valid and which are not, and model the space of the following problem: An interest group from a small town decided to sue a company for commercial abuse. For this, the people have organized themselves and decided to send 3 representatives, who will have to travel in a Van to the city where the lawsuit will be filed. The company to be sued, upon learning of these actions, has decided to send 3 lawyers to persuade the representatives, who will also travel in the same Van for that purpose. The community must file the class action suit under these conditions: - The three applicants must reach the destination city; - Only two people can travel per trip in the Van (small town - city, city - small town); - There can never be more lawyers than plaintiffs in any one place (either in the small town or city) because the lawyers can persuade the plaintiffs and as a consequence, the lawsuit would not be made; - The Van cannot be…The world queen in the new post-apocalyptic world is extremely worried about the birth rate. She therefore orders that every family must have at least one daughter or else pay hefty fines. What will the gender ratio of the next generation be if all families adhere to this policy, which requires them to keep having children until they have one girl, at which point they immediately stop? (Presume that all pregnancies have an equal chance of producing a boy or a girl.) Write a computer simulation of this problem when you have logically resolved it.The world monarch in the new post-apocalyptic world is extremely worried about the birth rate. She therefore orders that every family must have at least one female or else pay hefty fines. What will the gender ratio of the next generation be if all families adhere to this policy, which requires them to keep having children until they have one girl, at which time they immediately stop? (Presume that all pregnancies have an equal chance of producing a male or a girl.) Write a computer simulation of this problem after you have rationally resolved it.
- A safe is locked by a combination of of four binary digits (that is, 0 or 1), but theowner has forgotten the combination. The safe is designed in such a way that nomatter how many digits have been pressed, if the correct combination of three digitsis pressed at any point, then the safe automatically opens (there is no ”enter” key).Our goal is to find the minimum number of digits that one needs to key in in order toguarantee that the safe opens. In other words, we wish to find the smallest possiblelength of a binary sequence containing every four-digit sequence in it.(a) Create a digraph whose vertex set consists of three-digit binary sequences. Fromeach vertex labelled xyz, there is one outgoing edge (labelled 0) leading to vertexyz0, and another outgoing edge (labelled 1) leading to vertex yz1.(b) Explain why every edge represents a four digit sequence and why an Euleriantour of this graph represents the desired sequence of keystrokes.(c) Find the minimum number of digits that one…Derive rules of thumb that apply when the new input size is the square root of the original input size for each scenario below. Be sure to show the mathematical result and give an English sentence for the rule of thumb, in the usual style e.g. “If the new size is the square root of the original size then the runtime is divided by the original size.” (Don't use variables like "n" in your sentence, say "the original size" or "the new size".) a. T(n) = kn b. T(n) = klogn c. T(n) = kn2 d. T(n) = knlognSuppose we have a group of proposed talks with preset start and end times. Students of CSE340 were asked to design an algorithm to schedule as many of these talks as possible in a lecture hall, under the assumptions that once a talk starts, it continues until it ends, no two talks can proceed at the same time, and a talk can begin at the same time another one ends. Assume that talk j begins at time sj (where s stands for start) and ends at time ej (where e stands for end). One student proposed the algorithm shown in Algorithm 1 on the next page, which simply adds talks in order of earliest start time (smallest sj ). (a) Prove, using a counter example, that the proposed algorithm does not always produce an optimal schedule (i.e., a schedule with most possible talks). (b) Another student proposed adding talks in order of shortest duration (ej - sj ). Prove, using a counter example, that even with this new criteria, the algorithm does not always produce an optimal schedule.
- Imagine you have a strip of highway connecting n towns in a line. Each town is being evaluated as a possible location for building a cellular phone tower. Each cell tower will provide coverage to the town it’s built in, but no other towns. However, due to the way that cell towers interfere with one another, it’s not possible to build cell phone towers in two adjacent towns.Describe an algorithm that, given the populations of each of the towns, reports the maximum number of people you can provide cell phone coverage to, subject to the restriction that no two adjacent towns can each have cell towers in them. Use dynamic programming to dramatically speed up your solution over a na ̈ıve recursive algorithm.1. Solve the Eight Tiled Puzzle Problem Using Hill-climbing algorithm with the help ofC++ programming language. Initial state and goal state are given below. 4 7 2 5 8 1 3 6 Initial State 1 2 3 4 5 7 8 6 Goal State Expected Outcome.a. The number of steps required to solve the puzzle.b. Print the best state after each iteration of hill-climbing requirements:no pre-defined functionsquee and algorithm library not allowedIostream only no otherAnswer the following: This problem exercises the basic concepts of game playing, using tic-tac-toe (noughts and crosses) as an example. We define Xn as the number of rows, columns, or diagonals with exactly n X’s and no O’s. Similarly, On is the number of rows, columns, or diagonals with just n O’s. The utility function assigns +1 to any position with X3=1 and −1 to any position with O3=1. All other terminal positions have utility 0. For nonterminal positions, we use a linear evaluation function defined as Eval(s)=3X2(s)+X1(s)−(3O2(s)+O1(s)). a. Show the whole game tree starting from an empty board down to depth 2 (i.e., one X and one O on the board), taking symmetry into account. b. Mark on your tree the evaluations of all the positions at depth 2. c .Using the minimax algorithm, mark on your tree the backed-up values for the positions at depths 1 and 0, and use those values to choose the best starting move. Provide original solutions including original diagram for part a!