(General math) Write, compile, and run a C++
After verifying that your program works correctly by calculating the distance between the two points manually, use your program to determine the distance between the points (-12, -15) and (22, 5).
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
C++ for Engineers and Scientists
- (C++ OOP) We have a house with 3 rooms.We need the user to enter 1 integer as the window number, 2 doubles as depth and width of the room, 1 double as the useless area, 1 boolean as the door's opening direction (e.g. 0 is outward).Program will compute and print the air condition as a string and the total useful area of the house as a double. Calculating the air condition: Name it air_c. Divide the useful area by the window number. If air_c >20, output "bad". If air_c <11 output "good". If 11<=air_c<=20, output "ideal". Attention: If the window number is 0, air condition is bad. Calculating the useful area of room: Width*Depth-(useless area)if the door is inward;Width*Depth-(useless area)-0.8The worst air condition of the 3 is the final air condition of house. --- 1)The information about the home must be all private within a class.2)The class must get these inputs within constructor func.3)Calculating the useful area of a room must be done within a function of a class.4)Air…arrow_forward(c++) Write a program that takes user input describing a playing card with the following shorthand: A = Ace 2...10 card values J = Jack Q = Queen, etc. D = Diamonds S = Spades. etc. Ex. if the user enters QS then your program responds with Queen of Spadesarrow_forwardProblem 2. (Playing the Waltz) Write a program called playwaltz.py that accepts from standard input, a sequence of 32 integers representing the 32 measures of a waltz, and plays the waltz to standard audio. Before playing any audio, your program must check if the inputs are correct, and if they are not, must call sys.exit (message) to exit the program with an appropriate error message. The following errors must be handled: • If the number of measures is not 32, exit with the message "A waltz must contain exactly 32 measures". • If a minuet measure is not from [1,176], exit with the message "A minuet measure must be from [1, 176]". • If a trio measure is not from [1,96], exit with the message "A trio measure must be from [1, 96]". - "/vorkspace/project3 $ python3 generatewaltz.py < data/mozart.txt | python3 playwaltz. py Directions: • Read the waltz measures from standard input into a 1D list. • Handle the input errors described above. • Play each of the first 16 minuet measures by…arrow_forward
- (Electrical eng.) The electrical resistance, r, of a metal wire, in ohms, is given by this formula: ml a mis the resistivity of the metal. Tis the length of the wire in feet. a is the cross-sectional area of the wire in circular mils. Using this information, you need to write a C++ program that calculates the resistance of a wire that's 125 feet long, has a cross-sectional area of 500 circular mils, and is copper. The resistivity of copper, m, is 10.4. a. Determine the outputs required of the program. b. What inputs does the program require? c. What is the formula for obtaining the outputs from the inputs?arrow_forward(C PROGRAMMING ONLY) 1. Dealing With Monthsby CodeChum Admin We're done dealing with days. It's time to step up and now deal with months! Instructions: In the code editor, you are provided with a code in the main() which has 12 printf's. Each printf prints a month with its corresponding value. For this program, January is 1, February is 2, March is 3, and so on. When you run the initial code, you will encounter errors because these month names that have been printed don't exist yet.Your task is to create an enum data type which contains these month names as values so that when we run the code, there will be no more error.Do not edit anything in the main(). Output January = 1February = 2March = 3April = 4May = 5June = 6July = 7August = 8September = 9October = 10November = 11December = 12arrow_forward(USING C++)A new video store in your neighborhood is about to open. However, it does not have a program to keep trackof its videos and customers. The store managers want someone to write a program for their system so thatthe video store can operate.arrow_forward
- (c++) Ask the user to provide a single alphabetic character. Print Vowel or Consonant depending on the input. If the u not a letter (between a and z or A and Z) or is a string of length > 1, print an error.arrow_forward(QUESTION) Using the required programming language (python, matlab, etc.) plot the variation of pressure on the piston surface as a function of time until the piston moves 9 m, with the help of the following commands below. This problem will be solved for U_p =1, 4, 16, 64, 256 m/s. We'll assume that the time starts at t = 0 when the piston starts moving. (PLEASE TAKE A SCREENSHOT OF THE PLOTTING AND OTHER RESULTS.) Note: Since we don't have the exact time intervals or the rate at which the piston moves, we'll assume a constant speed and divide the distance by the speed to get the time taken. (QUESTION) COMMANDS import matplotlib.pyplot as plt import numpy as np # Given parameters diameter = 0.1 # meters length = 10 # meters initial_pressure = 10e3 # Pascals initial_temperature = 288 # Kelvin # Convert diameter to radius radius = diameter / 2 # Calculate initial and final volumes initial_volume = np.pi * radius**2 * length final_volume = np.pi * radius**2 * (length - 9) # Calculate…arrow_forwardPlease use C PROGRAM by making the code. (Please see attached photo)arrow_forward
- (software quality engineering)Derive the test cases using boundary value analysisarrow_forward(C++) Write a function definition called quotient that takes as its parameters two decimal values, numer and denom, to divide. Remember that division by 0 is not allowed. If division by 0 occurs, display the message "NaN" to the console, otherwise display the result of the division and its remainder.arrow_forward(C++ Programming) Question 1: Write a program which the user is asked to enter two integers. Then, the sum of these two integers and displayedon the screen. Question 2: Design a program using “For Loop” that will output the “seven” times table as follow:7 x 1 = 77 x 2 = 147 x 3 = 21:7 x 10 = 70arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education