Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 1, Problem 5P

Modify the C++ program that you entered in Practice Program 1. In this version calculate the total length of fence you would need to enclose a rectangular area that is width feet long and height feet tall. The program should have variables for width and height with values entered by the user. Create another variable, totalLength, that stores the total length offence needed (which your program should calculate). Output the total with an appropriate message.

Blurred answer
Students have asked these similar questions
Use C++  programming language A customer in a store is purchasing five items. The prices of the five items are:Price of item 1 = $15.95Price of item 2 = $24.95Price of item 3 = $6.95Price of item 4 = $12.95Price of item 5 = $3.95Write a program that holds the prices of the five items in five variables. Display each item’sprice, the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is7%.
using c++ Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered:   The number of days spent in the hospital The daily rate Hospital medication charges Charges for hospital services (lab test, etc.)   The program should ask for the following data if the patient was an out-patient:   Charges for the hospital services (lab test, etc.) Hospital medication charges   The program should use two functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out-patient information. Both functions should return the total charges.
Write a program in C++ that: Declares a variable suitable for holding a person’s name Prompts the user to enter a person’s name with the text Enter name: Reads the user's input and stores it in the variable created in step 1 Outputs the following information about the name they entereda. The index of the first character of the last nameb. The first 3 characters of the first namec. The last 3 characters of the last nameYour output should look like the examples below. **Note: Your code should account for the fact that the user might enter a middle name or initial. Example 1: Enter name: Grace Hopper Index of the first character of the last name: 6 First 3 characters of the first name: Gra Last 3 characters of the last name: per Example 2: Enter name: Dorothy J. Vaughan Index of the first character of the last name: 11 First 3 characters of the first name: Dor Last 3 characters of the last name: han

Chapter 1 Solutions

Problem Solving with C++ (9th Edition)

Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License