Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 18PC
Future Ocean Levels
During the past decade ocean levels have been rising faster than in the past, an average of approximately 3.1 millimeters per year. Write a
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
During the past decade ocean levels have been rising faster than in the past, an average of approximately 3.1 millimeters per year. Write a program that computes how much ocean levels are expected to rise during the next 20 years if they continue rising at this rate. Display the answer in both centimeters and inches.
Airline companies apply baggage restrictions for their passengers. An
airline company has decided to apply a 10kg limitation for
passengers' hand luggage and 20kg for their normal baggage. When
passengers arrive, they enter their hand and normal luggage weight
from the keyboard. If passengers exceed their normal baggage
allowance of 10 dollars per gram, they pay 12 dollars per kg.
Accordingly, write the program that calculates the baggage price of
the airline they will go to according to the baggage values entered by
the arriving passenger and keeps this from closing the program for
each passenger. Note: If hand and normal baggage allowances are
stretched below the maximum value, the payment amount will be
considered not negative. An example printout is given on the right.
Geri bildirim gönder
When Jacob Steinberg began his trip from California to Vermont, he filled his car’s tank with gas and reset its trip meter to 0. After traveling 324 miles, Jacob stopped at a gas station to refuel; the gas tank required 17 gallons. Jacob wants a program that calculates and displays his car’s gas mileage at any time during the trip. The gas mileage is the number of miles his car can be driven per gallon of gas. Desk-check your solution’s algorithm using 324 as the number of miles driven and 17 as the number of gallons used; then desk-check it using 280 and 15.
Chapter 2 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 2.1 - The following C++ program will not compile because...Ch. 2.1 - On paper, write a program that will display your...Ch. 2.3 - Prob. 2.3CPCh. 2.3 - What output will the following lines of code...Ch. 2.3 - On paper, write a program that will display your...Ch. 2.5 - Which of the following are legal C++ assignment...Ch. 2.5 - List all the variables and literals that appear...Ch. 2.5 - When the above main function runs, what will...Ch. 2.5 - When the following main function runs, what will...Ch. 2.7 - Which of the following are illegal C++ variable...
Ch. 2.7 - Prob. 2.11CPCh. 2.7 - Prob. 2.12CPCh. 2.7 - Prob. 2.13CPCh. 2.7 - How would you combine the following variable...Ch. 2.7 - How would you combine the following variable...Ch. 2.8 - Prob. 2.16CPCh. 2.8 - What will the following code display? int number;...Ch. 2.8 - Prob. 2.18CPCh. 2.10 - Prob. 2.19CPCh. 2.10 - Which of the following is a character literal? 'B'...Ch. 2.10 - Prob. 2.21CPCh. 2.10 - What is wrong with the following program...Ch. 2.10 - Prob. 2.23CPCh. 2.10 - Write a program that stores your name, address,...Ch. 2.15 - Is the following assignment statement valid or...Ch. 2.15 - What is wrong with the following program? How...Ch. 2.15 - What will be assigned to x in each of the...Ch. 2.15 - Prob. 2.28CPCh. 2 - Every complete statement ends with a _____.Ch. 2 - To use cout statements you must include the _____...Ch. 2 - Every C++ program must have a function named...Ch. 2 - Prob. 4RQECh. 2 - A group of statements, such as the body of a...Ch. 2 - 'A', and "Hello World" are all examples of _____.Ch. 2 - 978.65 1012 would be written in E notation as...Ch. 2 - Prob. 8RQECh. 2 - Write a C++ statement that defines the double...Ch. 2 - Write a C++ statement that defines the int...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Modify the following program segment so it prints...Ch. 2 - Rewrite the follow statement to use the newline...Ch. 2 - Create detailed pseudocode for a program that...Ch. 2 - Prob. 24RQECh. 2 - Prob. 25RQECh. 2 - Create detailed pseudocode for a program that...Ch. 2 - What will the following programs print on the...Ch. 2 - A) #include iostream using namespace std; int main...Ch. 2 - The following program contains many syntax errors....Ch. 2 - Soft Skills Programmers need good communication...Ch. 2 - Sum of Two Numbers Write a program that stores the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Sales Tax Write a program that computes the total...Ch. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Miles per Gallon A car holds 16 gallons of...Ch. 2 - Distance per Tank of Gas A car with a 20 gallon...Ch. 2 - Number of Acres One acre of land is equivalent to...Ch. 2 - Land Calculation In the United States, land is...Ch. 2 - Prob. 10PCCh. 2 - Triangle Pattern Write a program that displays the...Ch. 2 - Diamond Pattern Write a program that displays the...Ch. 2 - Pay Period Gross Pay A particular employee earns...Ch. 2 - Basketball Player Height The star player of a high...Ch. 2 - Energy Drink Consumption A soft drink company...Ch. 2 - Past Ocean Levels The Earths ocean levels have...Ch. 2 - Future Ocean Levels During the past decade ocean...Ch. 2 - Annual High Temperatures The average July high...Ch. 2 - How Much Paint A particular brand of paint covers...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Modify the temperature conversion program to print a heading above the table.
C Programming Language
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
(Geometry: point in a circle?) Write a program that prompts the user to enter a point (x, y) and checks whether...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
The _________ specifies how a classs field or method may be accessed by code outside the class. a. field declar...
Starting Out with Programming Logic and Design (4th Edition)
The ______ mode flag causes an offset to he calculated from the current position in the file.
Starting Out with C++: Early Objects
Prime Number List This exercise assumes that you have already written the is_prime function in Programming Exer...
Starting Out with Python (4th Edition)
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
- 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_forwardGiven an airplane's acceleration and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula. length=v^2/2*a. write a program that prompts the user to enter V in meters and acceleration an in meter/second and display the minimum runway length.arrow_forwardAn oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The spilled oil sits on top of the water and causes a natural disaster. For simplicity, suppose that the oil sits on top of the water in the form of a circle. Write a program that prompts the user to enter the rate at which the ruptured pipe pumps oil (in gallons) per minute, the thickness of the oil on top of the water, and the number of days for which the area is covered by the spilled oil. The program outputs the spilled area (in kilometer) and the volume of oil (in gallons) on top of the water after each day.arrow_forward
- A pendulum is simply a weight attached to a fixed point, usually through a string or a rod, and it swings freely backward and forward. The period of a pendulum is the amount of time that it takes to go from one point to another as it swings. Length of pendulum SWING T = PERIOD of the swing The formula to compute the period (7) is the following: T = 2π g=9.8 m/sec² L is the arm length of pendulum in meters. The unit of the period (7) is seconds. Write a program that will generate a table that will show the period (7) for several pendulums with lengths (L) in the range 10cm ≤L≤ 100cm in increments of 2cm. Your code must: 1) include a user-define function that performs a single period calculation, use the following function prototype: void pendulumPeriod(float length, float *period) 2) display to the monitor the length and period of the pendulums in table format with a header and units. 3) save the lengths and period of the pendulums to a file.arrow_forwardTransient PopulationPopulations are affected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population P The annual birth rate (as a percentage of the population expressed as a fraction in decimal form)B The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D The average annual number of people who have arrived A The average annual number of people who have moved away M The number of years to display nYears Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formulaN = P + BP - DP + A - Mwhere N is the…arrow_forwardA parking garage charges a $2.00 minimum fee to park for up to three hours and an additional $1 per hour for each hour or part thereof over four hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format, and should calculate and print the total of yesterday's receipts. The program should use the function calculate Charges to determine the charge for each customer.arrow_forward
- One acre of land is equivalent to 43,560 square feet. Write a program that calculates the number of acres in a tract of land with 389,767 square feet.arrow_forwardGiven an airplane’s acceleration a and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula: length = v2/2a Write a program that prompts the user to enter v in meters/second (m/s) and the acceleration a in meters/second squared and displays the minimum runway length.arrow_forwardthere are three seating categories at a stadium. for a softball game, class A seats are $30, Class B seats are $20 and Class C seats are $15. Write a program that asks how many tickets for each class of seats were sold and then displays the amount of income generated from ticket sales. answer using C++arrow_forward
- Given the sample code above in generating a random number. Create 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. 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, then the computer has chosen scissors. (Don't display the 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.) 13. The computer's choice is displayed. 4. A winner is selected according to the following rules: a. If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.) b. If one player chooses scissors and the other player chooses paper, then scissor wins. (Scissors cuts paper.) c. If one player chooses paper and the other player…arrow_forwardA mass m is attached to the end of a rope of length r 3 meters. The rope can only be whirled around at speeds of 1, 10, 20, or 40 meters per second. The rope can with stand a maximum tension of T = 60 Newtons. Write a program where the user enters the value of the mass m, and the program determines the greatest speed at which it can be whirled without breaking the rope. Assume that the mass m is less than 100 kg. Hint: T = mv2 /r. Drop Your Code here: #Set the rope length #Set the maximum tension #Set the message #Read the mass value #Set a list of possible rotation speed #Set the size of the list Drag your statements from the following choices: length = 3 max_tension = 60 message = "The greatest speed without breaking the rope is:" mass = float(input(">>>Enters the value of the mass m: ")) rotation_speed - [1. 10, 20, 40] N= len(rotation_speed) pos - N-1 for i in range (N): tension = mass"rotation_speed[i)*2/length if tension>max tension: pos i-1 break…arrow_forwardA parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format and should calculate and print the total of yesterday’s receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format Sample output Enter the hours parked for 3 cars: 1.5 4.0 24.0 Car Hours Charge 1 1.5 2.00 2 4.0 2.50 3 24.0 10.00 TOTAL 29.5 14.50arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author: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
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY