Introduction to Programming with C++
3rd Edition
ISBN: 9780133252811
Author: Y. Daniel Liang
Publisher: Prentice Hall
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 1, Problem 9PE
(Area and perimeter of a rectangle) Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
using python, show #comments
Write a program that reads the length and width of a rectangle as integers from the keyboard and then calculates and printsa) the area of the rectangle, andb) The circumference of the rectangle.
VPython
3500) assignments/3090165
Answers to
ms to Canvas for the following problems. There should be 7 programs.
4B, 5, 6
1. A. Write a VPython program that creates eight spheres, each placed at one corner of a cube
centered on the origin. The length of a side of the cube should be 6 units, and the radius of each
sphere should be 0.5. Use at least two different colors for the spheres.
B. Add to the program an arrow whose tail is at one corner of the cube and whose tip is at the
corner diagonally opposite. The figure below shows the display from one possible solution to
this problem.
2. Write a VPython program that represents the x, y, and z axes by three cylinders of different
colors. This display from one possible solution is below.
Chapter 1 Solutions
Introduction to Programming with C++
Ch. 1 - Prob. 1CPCh. 1 - Prob. 2CPCh. 1 - Prob. 3CPCh. 1 - Prob. 4CPCh. 1 - Prob. 5CPCh. 1 - What is memory used for? What does RAM stand for?...Ch. 1 - Prob. 7CPCh. 1 - Prob. 8CPCh. 1 - Prob. 9CPCh. 1 - What language does the CPU understand?
Ch. 1 - What is an assembly language?
Ch. 1 - What is an assembler?Ch. 1 - What is a high-level programming language?Ch. 1 - What is a source program?
Ch. 1 - What is an interpreter?
Ch. 1 - What is a compiler?
Ch. 1 - Prob. 17CPCh. 1 - Prob. 18CPCh. 1 - Prob. 19CPCh. 1 - Prob. 20CPCh. 1 - Prob. 21CPCh. 1 - Prob. 22CPCh. 1 - Explain the C++ keywords. List some C++ keywords...Ch. 1 - Is C++ case sensitive? What is the case for C++...Ch. 1 - What is the source file name extension, and what...Ch. 1 - What is a comment? What is the syntax for a...Ch. 1 - Prob. 27CPCh. 1 - What does the namespace std stand for?
Ch. 1 - Which of the following preprocessor directive is...Ch. 1 - Prob. 30CPCh. 1 - Show the output of the following code:
Ch. 1 - Show the output of the following code:...Ch. 1 - Prob. 33CPCh. 1 - Prob. 34CPCh. 1 - Identify and fix the errors in the following...Ch. 1 - Prob. 36CPCh. 1 - Reformat the following program according to the...Ch. 1 - Prob. 38CPCh. 1 - Prob. 39CPCh. 1 - If your program needs to read data from a file,...Ch. 1 - Suppose you write a program for computing the...Ch. 1 - Identify and fix the errors in the following...Ch. 1 - (Display three messages) Write a program that...Ch. 1 - (Display five messages) Write a program that...Ch. 1 - (Display a pattern) Write a program that displays...Ch. 1 - (Print a table) Write a program that displays the...Ch. 1 - (Compute expressions) Write a program that...Ch. 1 - (Summation of a series) Write a program that...Ch. 1 - (Approximate ) can be computed using the...Ch. 1 - (Area and perimeter of a circle) Write a program...Ch. 1 - (Area and perimeter of a rectangle) Write a...Ch. 1 - (Average speed in miles) Assume a runner runs 14...Ch. 1 - (Population projection) The U.S. Census Bureau...Ch. 1 - (Average speed in kilometers) Assume a runner runs...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forwardThe correct statements are: (ab)*a = a(ba)* (a U b)* b (a U b)* = a*b (a U b)* (a U b)* ba (a U b)* U a*b* = (a U b)* □ (a U b)* b (a U b)* U (a U b)* a (a U b)* = (a U b)*arrow_forward2. C program to draw pyramid with *. Ex – height 4: *** ***** ******* Hint: According to bottom line, find the number of blank characters at the first line(how many blank is at right side and how many blank is at left side?). If height of pyramid is 4, then bottom line has got 7 asterix ((4-1)*2+1). First line has got 6 blank (4-1 left side and 4-1 right side) characters and one Asterix (at the middle.arrow_forward
- Write a program that reads non-negative integer number and determines whether it is odd or even or prime?arrow_forwardUse python fast 20 minutesarrow_forward2. - Write a program that displays the area and perimeter of a rectangle with the width of 5 And height of 7.5 using the following formulas: area = width * height perimeter = 2 * width + 2 * height 3. Write the output from the following code: A. sum = for i in range(0,13,2): sum+ = i print ("sum = ", sum)arrow_forward
- A-Write a program to compute the drag force F, (in Newton) When a body swims through fluid, the drag force is given by 1 F₁ =pV²ACD Take: p= 1000 kg/m3 is the density of fluid, V 1.25 (m/s) is the swimming speed, A=0.25 m² is the frontal area of the body, Cp=0.09 is the coefficient of drag. Matlaparrow_forwardPython Programming Part 2 Direction: Use PYTHON to solve this problem. Description: This part tests for two things. The program must identify all resistors in series or in parallel with each other and calculate the equivalent resistance for each group of resistors. Recall that total resistance of resistors in series are added up while the total conductance of those in parallel are added up. Input Format: The first line of the input consists of 1 integer N which is the total number of resistors. The next N lines will consist of 3 strings and an integer R each separated by a space. The first string is the resistor name, the second and third strings are the node names where the resistor terminals are connected, and R is its resistance value. Output Format: One line for each group of resistors in series or parallel. Each line starts with a list of resistors arranged in lexicographical order (see Lexicographic order - Wikipedia) followed by their total resistance rounded off to the nearest…arrow_forwardQ2/ If x from (1-10) write a program to print the summation of every two consecutive even numbers (2+4) (4+6) (6+8) ... اكتب برنامج بلغة الفورتران لطباعة مجموع كل رقمي ين زوجي ين متعاقي ي ين ل لأعداد المحصورة بين 1 إلى 10arrow_forward
- 5- Write a program which read a number consists of 4 digits and find the maximum digit of the number. FOR eg. 1472 the maximum digit is 7 the maximum digit is 9 9835arrow_forwardLet the variables x be "dog" and the variable y be "cat". Write the values returned by the following operations: a. x + y b. "the " + x + " chases the " + y c. x * 4arrow_forwardSummary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: 130 50 130 the output is: 80 0 80 Find the smallest value, and then subtract it from all three values, thus removing the gray. Note: This page converts rgb values into colors. 461710.3116374.qx3zqy7 LAB ACTIVITY 1 111 4.10.1: LAB: Remove gray from RGB Type your code here. 111 main.py 0/10 Load default template...arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License