Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 12.2, Problem 12.6CP
Program Plan Intro
Inserting or deleting characters in a string:
- Library function or modules are provided by the
programming languages to perform insert and
Inserting:
The pseudocode library modules that are used to insert the values is :
insert (string1,position,string2)
- The above function will insert the “string 2” to the “string1” at the “position” specified.
- “string1” and “string2” is string
- “Position” is an integer.
Deleting:
The pseudocode library modules that are used to insert the values is
delete (string1,start,end)
- The above function will delete the strings that are specified from the start to the end.
- “Start” and “End” is integer that specifies the beginning position and end position.
- “String” is string.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Programming Assignment: Car Repair
For this programming assignment, create a car repair program that prompts the user to enter
information about a customer, the customer's vehicle, and the work performed on the customer's
vehicle. Your program should then display the final car repair bill on the computer screen.
Your program should accomplish the following:
1. Prompt the user to enter the following information:
a. Information about the customer (name, street address, city, state, zip code, phone
number).
b. Information about the customer's vehicle (make, model, year).
c. Information about the work performed (brief description, labor hours needed, cost of
parts).
2. Use a labor cost amount of $100.00 per hour and a sales tax rate of 7.0%.
3. Calculate the following:
Variable
subtotal
sales tax
total repair bill amount
Formula
subtotal = labor cost per hour * number of labor hours
sales tax = sales tax rate * subtotal
total repair bill amount = subtotal + sales tax
4. A screen shot of a…
The Problem__:
Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions:
⚫ void getScore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered.
⚫ void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores.
⚫int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop.
Input Validation: Do not accept test scores lower than 0 or higher than 100.
YOU MUST USE THE STATED FUNCTIONS AND COMPLETE Input VALIDATION.
**DO NOT use an ARRAY OR GLOBAL VARIABLES!!.
you MUST USE function prototyping
TEST THE FUNCTION TWICE.…
The declaration statement for a named constant requires .
a. a data typeb. a name
c. a value
d. all of the above
Chapter 12 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 12.2 - Prob. 12.1CPCh. 12.2 - Prob. 12.2CPCh. 12.2 - Design an algorithm that determines whether the...Ch. 12.2 - Design an algorithm that determines whether the...Ch. 12.2 - Prob. 12.5CPCh. 12.2 - Prob. 12.6CPCh. 12 - Prob. 1MCCh. 12 - Prob. 2MCCh. 12 - If the str variable contains the string "berry",...Ch. 12 - If the str variable contains the string "Redmond",...
Ch. 12 - Prob. 5MCCh. 12 - Prob. 1TFCh. 12 - Prob. 2TFCh. 12 - If the String variable str contains the string...Ch. 12 - The insert library module automatically expands...Ch. 12 - Prob. 5TFCh. 12 - Prob. 6TFCh. 12 - Prob. 7TFCh. 12 - Prob. 1SACh. 12 - If the following pseudocode were an actual...Ch. 12 - Prob. 3SACh. 12 - Prob. 4SACh. 12 - Prob. 5SACh. 12 - Design an algorithm that counts the number of...Ch. 12 - Prob. 2AWCh. 12 - Design an algorithm that counts the number of...Ch. 12 - Design an algorithm that deletes the first and...Ch. 12 - Design an algorithm that converts each occurrence...Ch. 12 - Design an algorithm that replaces each occurrence...Ch. 12 - Assume the following declaration exists in a...Ch. 12 - Prob. 1DECh. 12 - Prob. 2DECh. 12 - Prob. 3DECh. 12 - Prob. 1PECh. 12 - Sentence Capitalizer Design a program that prompts...Ch. 12 - Prob. 3PECh. 12 - Sum of Digits in a String Design a program that...Ch. 12 - Prob. 5PECh. 12 - Alphabetic Telephone Number Translator Many...Ch. 12 - Word Separator Design a program that accepts as...Ch. 12 - Pig Latin Design a program that reads a sentence...Ch. 12 - Prob. 9PECh. 12 - File Encryption File encryption is the science of...Ch. 12 - File Decryption Filter Design a program that...Ch. 12 - Password Weakness Detector Design a program that...
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
- Look at the following code.double value = 29.7;double *ptr = &value;Write a cout statement that uses the ptr variable to display the contents of the valuevariable.arrow_forwardc# Danielle, Edward, and Francis are three salespeople at Holiday Homes. Write an application named HomeSales that prompts the user for a salesperson initial (D, E, or F) input as a string. Either uppercase or lowercase initials are valid. While the user does not type Z, continue by prompting for the amount of a sale. Issue the error message "Sorry - invalid salesperson" for any invalid initials entered. Keep a running total of the amounts sold by each salesperson. After the user types Z or z for an initial, display each salesperson’s total, a grand total for all sales, and the name of the salesperson with the highest total unless there is a tie. If there is a tie, indicate this in the program's output with the message: "There was a tie". An example of the program is shown below: Enter a salesperson initial >> D Enter amount of sale >> 10 Enter next salesperson intital or Z to quit >> d Enter amount of sale >> 2 Enter next salesperson intital or Z to quit…arrow_forwardComputer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Outputarrow_forward
- T F A variable must be defined before it can be used.arrow_forwardExercise I- Medicine Write a program that asks the user to enter the name of the medicine (t for ThroX, f for FeliX), his mass. The user should enter as well if he has a prescription or not. The program will calculate the dosage using: age and his ThroX without prescription -The max dosage should be 0.75 mL -The dosage = mass / 150 -The number of pills per day to take is 1 ThroX with prescription -The dosage =mass * 3 / 150 -The number of pills per day to take is 5 FeliX with prescription -The dosage = 0.77 mL FeliX without prescription -The dosage should be between 0.3 and 0.7 -The dosage = mass * 0.009 -The number of pills per day to take is 2 -The number of pills per day to take is 6 The program should display the dosage and the number of pills to be taken per day if the requirements are full filled, otherwise it display "Please check your doctor for a prescription". In case the medicine does not exist in the database, the program display “Your medicine is not in our database!"…arrow_forward#include <iostream>#include <string> using namespace std; int GetMonthAsInt(string month) { int monthInt = 0; if (month == "January") monthInt = 1; else if (month == "February") monthInt = 2; else if (month == "March") monthInt = 3; else if (month == "April") monthInt = 4; else if (month == "May") monthInt = 5; else if (month == "June") monthInt = 6; else if (month == "July") monthInt = 7; else if (month == "August") monthInt = 8; else if (month == "September") monthInt = 9; else if (month == "October") monthInt = 10; else if (month == "November") monthInt = 11; else if (month == "December") monthInt = 12; return monthInt;} int main () { // TODO: Read dates from input, parse the dates to find the ones // in the correct format, and output in m-d-yyyy format }arrow_forward
- Transcribed Image Text Write a program that asks for the principal, the annual interest rate, and the number of times the interest is compounded. It should display a report similar to the following: Interest Rate: 4.25% Times Compounded: 12 Principal: $ 1000.00 Interest: 43.33 Final balance: $ 1043.33arrow_forwardAssume a program has the following variable definitions int units; float mass; double weight;and the following statement:weight = mass * units;Which automatic data type conversions will take place?arrow_forwardDriving costs - functions Learning Objectives Create a function to match the specifications Use floating-point value division Instructions Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print(f'{your_value:.2f}') Ex: If the input to your program is: 20.0 3.1599 the output is: The gas cost for 10 miles is $1.58 The gas cost for 50 miles is $7.90 The gas cost for 400 miles is $63.20 Your program must define and call the driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should…arrow_forward
- Indicates the missing variable or operator: A + (B • C) = (A + B) • (A+___ )arrow_forwardTime CalculatorWrite a program that asks the user to enter a number of seconds.-There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes and leftover seconds in that many seconds.-There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours, minutes, and leftover seconds in that many seconds.-There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days, hours, minutes, and leftover seconds in that many seconds.arrow_forwardC++ Write a program that will accept the student's name. The program holds 20 names of students. The user must able to display the name of the student by entering its corresponding number.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning